I'im using the WTL 8 library, and I found there's a problem in one of the headers (atldlgs.h), which makes use of the GlobalReAlloc function.
Basically, the function fails, returns a NULL pointer, and GetLastError() returns 8, which means "not enough memory". Of course I have plenty of memory available... and the amount of requested bytes is very low.
Does some know the reason why GlobalReAlloc would fail? is it some bug ?
Or did I miss something?
Thanks in advance for any information about this,
I'm using Windows Vista SP2 + VS 2008.
Here is a simple program to reproduce the error:
int _tmain(int argc, _TCHAR* argv)
int size1 = 10240;
int size2 = 20480;
for (int i=0; i<15; i++)
HGLOBAL h = ::GlobalAlloc(GPTR, size1);
if (NULL == h)
_tprintf(_T("NULL! %d\r\n"), i);
HGLOBAL h2 = ::GlobalReAlloc(h, size2, 0);
if (NULL == h2)
_tprintf(_T("NULL 2! %d\r\n"), i);
_tprintf(_T("ok %d\r\n"), i);