Skip to main content
GameDev.net gamedev.net
🔒 Locked

Windows resource problem...

Started by ver_T_ex Dec 11, 2005 at 1:59 PM 2 replies 1k views
Original Post
ver_T_ex
ver_T_ex
Hi guys, I was confronted with this little problem when I coded a simple dialog based win32 program in cpp. Everything worked great but suddenly (I don't know the reason ) the tray icon , bitmaps , font , everything concerning the gui disappears and here you can see what it looks like! Of course I googled the problem but it doesn't tell me what I did wrong in my code. Has anyone any idea what could cause it ? Thanks for your help! verTex
Illco
Illco
One thing that comes to mind is the following: many of the objects you receive a handle to through the Win32 API you receive only in loan -- when done you must return them by releasing them. This goes for example for GDI objects such as pens, fonts, etc. but also for device contexts (HDCs), bitmaps, etc. There are a limit number of handles.

It might be the case that you take up too many handles, in combination with not releasing ones that are done with. That will produce an error like yours. Especially when you run the application multiple times or when there is a loop in which such calls are made.

Illco
Colin Jeanne
Colin Jeanne
It sounds like you are leaking GDI resources. Can you post your code?
ver_T_ex
ver_T_ex
The "not releasing handle" reason sounds as if it was quite possible. The code of the program is too long so unfortunately I can't post the code until I know more about the reason to locate the error. I will check the releasing of the handles ... (If someone knows another solution, feel free to share it )

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.