-
October 25th, 2010, 07:02 AM
#1
Disappearing Bitmap
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 am guessing some sort of a memory glitch..
Any help will be appreciated.
Thank You
-
October 25th, 2010, 07:06 AM
#2
Re: Disappearing Bitmap
Originally Posted by vinayak4gargya
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.
Victor Nijegorodov
-
October 25th, 2010, 07:48 AM
#3
Re: Disappearing Bitmap
It would of help if you could tell me what might cause such behaviour...
Any experience with this problem?
-
October 25th, 2010, 07:53 AM
#4
Re: Disappearing Bitmap
What happens with my car is that after a little time it stops running... its engine doesn't work anymore and I cannot more drive it!
It would of help if you could tell me what might cause such behaviour...
Any experience with this problem?
Victor Nijegorodov
-
October 25th, 2010, 07:56 AM
#5
Re: Disappearing Bitmap
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.
-
October 26th, 2010, 07:18 AM
#6
Re: Disappearing Bitmap
I m sorry my bad my bad!
Yes actually well i think the problem stems from the fact that i was using the same brush variable (hBrush) and initializing it again and again.
like i was doing this ::
################
hBrush = CreateSolidBrush(RGB(255,0,0));
SelectObject(hdc,hBrush);
.
.
.
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?
-
October 26th, 2010, 07:29 AM
#7
Re: Disappearing Bitmap
Hi,
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);
With regards
Programartist
-
October 26th, 2010, 07:35 AM
#8
Re: Disappearing Bitmap
Aha so thats it!
Thank you so much !
And sorry for being vague in the beginning , as you can guess , i am a newbie
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|