luke77 Posted February 14, 2011 Posted February 14, 2011 I would like to use heaplock and heapunlock.Does anyone have an example of their use?Thanks.
Glenn9999 Posted February 14, 2011 Posted February 14, 2011 What language? There's Microsoft's example.http://msdn.microsoft.com/en-us/library/ee175819%28v=vs.85%29.aspx
CoffeeFiend Posted February 14, 2011 Posted February 14, 2011 Not sure what for, or in what language. So I'll assume VC++ and doing nothing else besides lock/unlock...#include <windows.h>#include <iostream>void main(){ HANDLE hHeap = GetProcessHeap(); //or HeapCreate if(hHeap == 0) { printf("GetProcessHeap error %d\r\n", GetLastError()); return; } if(!HeapLock(hHeap)) { printf("HeapLock error %d\r\n", GetLastError()); return; } //do something with it... if(!HeapUnlock(hHeap)) { printf("HeapUnlock error %u\r\n", GetLastError()); return; }}Edit: looks like Glen9999 beat me to it, and with nicer code too (and it's unicode...) Oh well
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now