Hello, I've got a question, let's say I've got a program thats supposed to be working until the user has decided to exit or logout windows. Now, how to make the program do it's last function (for example saving some content to a file) after the user has pressed shutdown or logout ?
In other words I am looking for the command that will tell my program that the user has pressed shutdown, so it is supposed to save the content before the computer actually shuts down.
When windows is shutting down (clean) it sends the WM_QUERYENDSESSION message to all of the Applications message queues to close. Since this message is recieved through the WinProc Callback function it should be enough for you to add an entry to handle this message. http://msdn.microsoft.com/en-us/library/windows/desktop/aa376890(v=vs.85).aspx