Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


ddraw app won't terminate!

This topic is 6670 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

My ddraw program won''t quit. I hit esc to quit, it closes the window, but it is still floating in the task manager! Any ideas on what''s wrong? THX! //////////////////////////////////////////////////////////// int Game_Main(void *parms = NULL, int num_parms = 0) { if (KEYDOWN(VK_ESCAPE)) SendMessage(main_window_handle,WM_CLOSE,0,0); FillSurface(primsurf,_RGB16BIT565(0,255,0) return(1); } // end Game_Main //////////////////////////////////////////////////////////// int Game_Init(void *parms = NULL, int num_parms = 0) { InitDirectDraw(800,600,16); return(1); } // end Game_Init ///////////////////////////////////////////////////////////// //////////////FROM HEADER/CPP ENGINE FILE //////////////// ///////////////////////////////////////////////////////////// int InitDirectDraw(int width, int height, int bpp) // Creates DirectDraw and creates a double buffer { LPDIRECTDRAW ddraw1obj; DirectDrawCreate( NULL, &ddraw1obj, NULL); ddraw1obj->QueryInterface(IID_IDirectDraw4,(LPVOID *)&ddraw4obj); ddraw1obj->Release(); ddraw1obj = NULL; ddraw4obj->SetCooperativeLevel( main_window_handle, DDSCL_EXCLUSIVE| DDSCL_FULLSCREEN| DDSCL_ALLOWMODEX); ddraw4obj->SetDisplayMode(width, height, bpp, 0, 0); ShowCursor(FALSE); DDSURFACEDESC2 surfdesc; memset(&surfdesc,0,sizeof(surfdesc)); surfdesc.dwSize=sizeof(surfdesc); surfdesc.dwFlags= DDSD_CAPS || DDSD_BACKBUFFERCOUNT; surfdesc.dwBackBufferCount = 1; surfdesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE || DDSCAPS_COMPLEX || DDSCAPS_FLIP); if(FAILED(ddraw4obj->CreateSurface(&surfdesc,&primsurf,NULL))) return(0); surfdesc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; if(FAILED( primsurf->GetAttachedSurface&surfdesc.ddsCaps,&backsurf))) return(0); width = Screen_Width; height = Screen_Height; bpp = Screen_BPP; return(1); } ///////////////////////////////////////////////////////////////// int FillSurface(LPDIRECTDRAWSURFACE4 surface, int color) { //clear out ddbltfx struct memset(&bltfxstruct,0,sizeof(bltfxstruct)); bltfxstruct.dwSize=sizeof(bltfxstruct); bltfxstruct.dwFillColor = color; if(FAILED(surface->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT, &bltfxstruct))) return(0); return(1); } /////////////////////////////////////////////////////////////////

Share this post

Link to post
Share on other sites
I assume you have a Shutdown function as well. If not, you need to make a Shutdown function which releases the surfaces and the DD object and whatever else. This could be your problem.

In your code, in WinMain, you probably have some code that looks like this:



while (1)
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
if (msg.message == WM_QUIT) break;

Game_Shutdown(); // add this

If you allready have a shutdown function than just ignore everything i said . Peace Out.

If you build a better mousetrap, the world will beat a path to your doorway...
Then the government takes most of your profits away in taxes. So much for hard work and ingenuity :(

Share this post

Link to post
Share on other sites

  • 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!