Jump to content

Recommended Posts


Posted

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 :)

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...