![]() |
| | #1 |
| Beginning game programmer Join Date: Jan 2008
Posts: 62
| I am currently learning graphics programming in DirectX (but I want to talk about my problem in general way, so I will not bother you with DirectX details). So let's say that we must first initialize the DirectX before using it and in the end of the application we must clean it up. So when the program runs normally and nothing obvious happens, the cleanup at the end of the program will run normally and the application will end. So everything is all right, yeah. Here is the sample: Code: int main()
{
initDirectX();
.
. // Whatever code in application
.
cleanup();
return 0;
}
For example what when the user press "CTRL+ALT+DEL" in the middle of the program and terminate the program himself? -> the cleanup will be NEVER achieved. So HERE IS MY QUESTION: ================================================== Is there any way to perform the cleanup of the application although the user terminates the application with "CTRL+ALT+DEL" (or where should I put my "cleanup()" function in the code)? ================================================== Thanks. Petike |
| Petike is offline | |
| | #2 | |
| The larch Join Date: May 2006
Posts: 3,217
| If I'm not mistaken, in case of Ctrl-Alt-Delete Windows will send your program a WM_CLOSE message or such, attempting to close the program in a usual way. If your program is caught in an infinite loop or such this will not probably work. But if your program gets stuck in an infinite loop, unloading resources is not the biggest problem?
__________________ I might be wrong. Quote:
| |
| anon is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| while statement | wonderpoop | C Programming | 13 | 10-23-2006 09:14 PM |
| Problem with com application | amardon | C++ Programming | 3 | 10-06-2005 05:50 AM |
| MFC run application by clicking on file... | dug | Windows Programming | 4 | 12-02-2004 04:33 AM |
| Win application not very portable | swed | Windows Programming | 5 | 10-01-2001 11:17 AM |