Hi.
A little trouble here, help needed.
Basically what happens in my program is that after a little time, the bitmaps from my program simply disappear!.. leaving behind a very blank and naked background with just the GDI figures left behind... (colours from the rectangles also disappear, probably deleting the brushes).
Why is this happening ?
Hi.
A little trouble here, help needed.
Basically what happens in my program is that after a little time, the bitmaps from my program simply disappear!.. leaving behind a very blank and naked background with just the GDI figures left behind... (colours from the rectangles also disappear, probably deleting the brushes).
Why is this happening ?
I guess it is because of some bug(s) in your program.
Seriously, vinayak4gargya, there's about a million things that could be wrong. You'll need to provide a lot more information on what you're doing. My guess would be that you are painting somewhere outside of the WM_PAINT handler.
hBrush = CreateSolidBrush(RGB(255,0,0));
SelectObject(hdc,hBrush);
.
.
.
hBrush = CreateSolidBrush(RGB(255,0,0));
SelectObject(hdc,hBrush);
...
################
and so on....
so this is wrong right?? i cannot initialize the same brush again and again?
you can initialize it for 1000 times and more, but:
you have to Deselect it from the HDC and you have to delete it!
Code:
hBrush = CreateSolidBrush(RGB(255,0,0));
HBRUSH hOldBrush = SelectObject(hdc,hBrush);
// do something with that brush here ...
SelectObject(hdc,hOldBrush);
DeleteObject(hBrush);
Bookmarks