There is a memory leak in the code, posted under the article : “Converting a bitmap to a region”.
At the end of the BitmapToRegion function, the lines:
// Clean up SelectObject(hDC, holdBmp); DeleteDC(hDC);
must be changed into :
// Clean u GlobalFree(hData); SelectObject(hDC, holdBmp); DeleteDC(hDC);