>>>When I was closing from the Task bar, I didn't get the message - this is the behavior I'd like to simulate - the shutdown initiated by Windows (say, Windows Update).
>>
>>Don't let Windows Update shut down anything
>
>Windows Update is just for example. I want this application to be properly closed if shutdown is initiated outside from the application. For now I need to properly simulate this case. My question is - what is the correct (programmatic) way of the simulation.
I suspect sending it a WM_CLOSE via PostMessage (
http://support.microsoft.com/kb/176391 )
But if closing it via the task manager works - why do you need a program ?
Gregory