Hi, I want to know can I set priority to my application such that the windows will close my application first when it shutsdown! Basically I want the window to ask my application to close itself before closing other programs when its shutting down. Thaks

I could be wrong, but, I believe windows cycles through the zorder to shut programs down. A way to test this is to have several programs or your design running. Tile them in the order you want on the desktop and when they are told by windows to shut down they use something like gettickcount and save that information to a file. Then once you are restarted, check those files.

Good Luck

Thanks for your reply I am using the following lines to check if the windows is shutting down
If UnloadMode = vbAppWindows Then (my code follows)
Is it possible for windows to send 'vbAppWindows' to my application first (as windows sends this command when it shutdown) and then the rest of the application

Please read my post more carefull and if you need help type in zorder, highlight it, and press F1 from inside vb.