luke77 Posted February 14, 2011 Share Posted February 14, 2011 I would like to use heaplock and heapunlock.Does anyone have an example of their use?Thanks. Link to comment Share on other sites More sharing options...
Glenn9999 Posted February 14, 2011 Share Posted February 14, 2011 What language? There's Microsoft's example.http://msdn.microsoft.com/en-us/library/ee175819%28v=vs.85%29.aspx Link to comment Share on other sites More sharing options...
CoffeeFiend Posted February 14, 2011 Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now