[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Simple Window Programming Questions

Posted on 2003-03-15
Medium Priority
Last Modified: 2010-04-01
I am developing a Game in GDI for Windows and uses WinAPI.

When I'm running the Game in WinXP everything is OK, but when I'm trying to run it under Win98 or WinME the Game Looses the Graphics and Font Settings that I have written...

I Think that it gottohave with the HDC stuff to do...

Uses the following to print the Graphics:

void GamePaint(HDC hdc)
     // Draw The Game Plan...
     GamePlan->Draw(hdc, 0, 0);


void GameCycle()
        HDC hDC = GetDC(Game->GetWindow());


     BitBlt(hDC, 0, 0, Game->GetWidth(), Game->GetHeight(),
          _hOffscreenDC, 0,0, SRCCOPY);
     DeleteDC(hDC); // Unsure if I sould delete it or not???

And a Second question:
Does someone have some info about desgining own Windows or some tutorial??
Question by:Snurre
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8143459
I don;t think windows 98 fully support GDI/GDI+ out of the box very well. Make sure you've downloaded the latest patches from Microsoft Update. Windows XP/Me/2000 would have newer versions that Win98. Maybe that's the issue.

Expert Comment

ID: 8143480
I think your mistake it's DeleteDC. Try to use ReleaseDC instead. Sorry for my English...

Expert Comment

ID: 8143491
GDI is fully supported out of the win 98 box.  GDI+ is not.  However this is not the problem....  It could be a problem with DeleteDC

from MSDN

"An application must not delete a device context whose handle was obtained by calling the GetDC function. Instead, it must call the ReleaseDC function to free the device context."

call ReleaseDC instead.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 8144551
Yes I Saw it on the MSN that it should be ReleaseDC instead, but, It's Still Messed up.

I'm going to explain a little more...

I have created all the nessesary stuff needed for my game, Bitmap Handlers and Sprites and more... And they are proofed to function under Win98 and Later...

But when I Started doing this Game I got the troubles with the Graphics disapering.

All I would need to know is, when should I Release the HDC Handler, It's used in many different Functions, Should I only have ONE Global HDC, does it make any difference in Passing the DC on in the Function header, or if I use the GetDC() Function??

My English isen't good Eighter... Sorry for the Inconvinience :o)

Accepted Solution

MirkoLMV earned 150 total points
ID: 8151808
Games relying on GDI are not expected anyway to be especially performant.
Normally a global Device Context used with almost no pause on the same window should not cause problems and could be released at the very end of using the window.

A good tutorial on Windows programming is written by Brook Miles, who likes to appear on the name The Forger.
Another good source for small Games in Window is the site

Gool luck !

Author Comment

ID: 8151910
I Give you the Points for the Funni little Gaming Site and The Tut you Recomended...


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question