There will be one application and also this little utility running under WinXP.
I want the util to shutdown the app in a way that allows it to save any data, and then to close WinXP and switch off the PC.
I don't know much about the WinAPI but my reading gets me to this point -
SetSuspendState(false, false, true); // give the app the chance to save data.
SetSuspendState(false, true, true); // Incase it refuses to close then force it to close.
ExitWindowsEx(EWX_POWEROFF or EWX_FORCE, 0); // shutdown winxp and switch the PC power off.
So how do I stop the SetSuspendState from closing the util before the util can issue the ExitWindowsEx?