I have not been able to get QueryUnload or Unload to work in Win2k when the User presses the Power Button on a ATX Power Supply.

Does ANYONE know the API routine to capture windows messages and detect when the operating system is shutting down?

My program losses data because I can't detect when it is shutting down.

Now if the user goes to Start > Shutdown > Shutdown then there is no problem.

Anyone with Win2k and ATX Power you will notice when you press the Power Button the computer shutdowns like three times fasters then going through the start button.

Megatron could you maybe help? I have posted this question on Microsoft Public VB WinAPI Newsgroup and no one has the answer.

Eagerly awaiting reply.