Jump to content
  • Advertisement
Sign in to follow this  
OrcishCoder

Bug in Win95/98/ME but Ok in WinXP/2K

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i really mad about my game problem: it is 2D gdi game. I just create some global hdcs (around 10-20), then select bitmap object to them. then one of the hdc is backhdc, which is used in double buffering. during game, no global hdc is deleted, and reselected. So i am sure those global hdcs keep available during game life time. but now, when i run my game in winxp, it works fine. but when i run in win95/98 system, the screen is black out. At first I suspect is because the createdc fail in win95, but after i check,it created sucessfully and during the black out, the images appears a short time, then black out again. So i can sure the image and dc is created and loaded successfully. Please help! Thanks in advance. regards, Martin

Share this post


Link to post
Share on other sites
Advertisement
Is it possible you are using some gdi function that is only in WinXP/2k. You could try and check all your system calls and see if they fail anywhere. Maybe update video card drivers.

Share this post


Link to post
Share on other sites
arh.. dont think so, because i just use normal gdi function that supported in all window system:

CreateCompatibleDC
CreateCompatibleBitmap
SelectObject
DeleteObject
DeleteDc
GetDc
ReleaseDc
BitBlt
FloodFill
FlashWindow
GetCursorPos
ClientToScreen
ScreenToClient

so, any idea?
thanks in advance


regards,
Martin

Share this post


Link to post
Share on other sites
win 95/98 have problems supporting that many global/common DCs. MSDN says 5 global DCs max per thread (unclear if that really is system, app or thread limits). 2k/XP obviously don't have this limit.

You'll need to change how your updating/drawing. For win95/98 use as few global DCs as you can for as little time as you can. You can use the own_dc flag when creating your window - that will allocate a private DC for that window

Share this post


Link to post
Share on other sites
thanks you guys! I solve the problem based on you guys suggestion and ideas. Thanks very much. It is because the evil: FloodFill() not supported in win9x/ME system or maybe I dont know how to use them well.


regards,
Martin

Share this post


Link to post
Share on other sites
FloodFill is actually available as far back as Windows 3.1, and is available only for 16 bit compatibility. You should use, ExtFloodFill instead. But, anyway, both of those functions should work with no problem on Win9x and later.
Leading me to suspect you have a DC leak in the function that was using the FloodFill. Like was mentioned before, NT and XP don't have any real limit on DC's, Win9x definately does however.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!