Re: [GD-Windows] Terminating a program
Brought to you by:
vexxed72
From: brian s. <bri...@gm...> - 2005-07-29 20:15:26
|
On 7/29/05, epa...@ko... <epa...@ko...> wrote: >=20 > I have divided my system to a launcher program and the actual (full > screen) graphics application. >=20 > In some cases the laucher needs to terminate the graphics application. >=20 > I have been trying > SendMessageTimeout(hwnd,WM_CLOSE,0,0, > SMTO_NORMAL, > 10000, > &res); >=20 > and >=20 > PostMessage(hwnd, WM_CLOSE, 0, 0) ; >=20 >=20 > but neither of these is fully reliable. In some cases > I get the Windows "End Program" dialogue on screen asking > the user if the program should really be terminated. Windows pops up that dialog box because your graphics application isn't=20 processing messages, so Windows considers the app to be hung. You should=20 figure out why that's happening, and fix the bugs in your graphics app so= =20 that it can actually process messages and shutdown cleanly. That is not ok for me. >=20 > Actually I don't really care if the program gets its chance of > getting cleanly shut down, but it is very much necessary that the > OpenGL (Nvidia) and sound drivers (Creative) are not left in a > corrupt state. And Windows (XP) itself must be able to get > all resources back etc. >=20 > Any ideas how to do this? Once you learn that there's a function called TerminateProcess() you may=20 think it's just what you need, but that is a very bad way to shut down an= =20 application, and it is likely to leave drivers in a corrupt state. --brian |