Hallo, I am trying to remove some strange things in my program and I found something which im not sure why is not working.
Why does not the first example of setClassLongPrt work?
Code:
HBITMAP img = (HBITMAP)LoadImage(NULL, TEXT(imgPath.c_str()), IMAGE_BITMAP,640,480,LR_LOADFROMFILE);
HBRUSH brush = CreatePatternBrush(img);
// this does not work, is simply loads a white image
SetClassLongPtr(overlayWindow,GCLP_HBRBACKGROUND,(LONG)brush);
// This works, but here I get problems after the function have been called several times. Memory leak?
// SetClassLongPtr(overlayWindow,GCLP_HBRBACKGROUND,(LONG)CreatePatternBrush(img));