CreateToolhelp32Snapshot Windows Mobile 5
-
Wednesday, July 12, 2006 8:50 AM
have struggled with getting the Sample app 'pviewce' to work under Windows Mobile 5, on an Imate Jamin (QTEK S200).
For some reason
CreateToolhelp32Snapshot();
Returns an
INVALID_HANDLE_VALUE
Now it gets even more weird, GetLastError() r== 8
Which means :"Not enough storage is available to process this command. "
I still have 19MB of free RAM, and other applications that use CreateToolhelp32Snapshot (exe files) seem to work.
Security is switched off.I am using "Windows Mobile 2005 SDK" for the PocketPC
Any clues ?
Thanks ...
Answers
-
Thursday, July 13, 2006 12:06 AMModerator
You're running out of memory as snapshoot includes all heaps by default. Please add "secret" TH32CS_SNAPNOHEAPS flag to fix that.
Note: TH32CS_SNAPNOHEAPS = 0x40000000
All Replies
-
Wednesday, July 12, 2006 11:25 PMI have exactly the same problem on Windows Mobile 5.0 (Pocket PC) calling CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) from a DLL
It returns an invalid handle and GetLastError() == 8 (not enough storage...)
And there is plenty of memory...
Couldn't find any way to solve it.
Any help ? Thanks again. -
Thursday, July 13, 2006 12:06 AMModerator
You're running out of memory as snapshoot includes all heaps by default. Please add "secret" TH32CS_SNAPNOHEAPS flag to fix that.
Note: TH32CS_SNAPNOHEAPS = 0x40000000
-
Thursday, July 13, 2006 12:17 AM
Try using TH32CS_SNAPNOHEAPS flag:
CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS|TH32CS_SNAPNOHEAPS, 0);
(Credit: Ilya Tumanov)
-
Thursday, July 13, 2006 9:53 AM
Cool stuff , working !
I am not sure how I could have figured this out, especially when the sample app, would normally work.
But thanks !
-
Thursday, July 13, 2006 10:00 AMIt works great !
Thank you very much for your answers !
Kaligero -
Monday, November 30, 2009 2:45 AMThats was deep deep in Win Mobile API. I have an old code from 2003 I was migrating to WM 2005, 6.0, 6.1 and when I saw that GetLastError()= 8 I panic. I use this method to kill my app when is running and I need to write to the database.
I also was checking my code and I kill iexplorer when I open, re-open it to display an html doc I create.
Thanks.
jorges@sierracode.com

