Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Oct : Delay Windows shutdown

www.cryer.info
Managed Newsgroup Archive

Delay Windows shutdown

Subject:Delay Windows shutdown
Posted by:"Jans" (..@no.com)
Date:24 Oct 2006 03:12:15

I want to delay Windows shutdown in order to perform
some ops. I found the following code written in C, which
can easily be rewritten in Delphi :

DmcWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch (uMsg)
{
...
case WM_QUERYENDSESSION:
{
        PostMessage(hWnd, UM_STARTBACKUP, 0, lParam);
        return FALSE;

}

case UM_STARTBACKUP:
{
        DmcBackupFiles();
        ExitWindowsEx(lParam == ENDSESSION_LOGOFF? EWX_LOGOFF: EWX_SHUTDOWN, 0);
        return TRUE;

}
...
}
}

But I don't know how to handle a reboot. In MSDN, they say
that lParam just tells if it's a logoff or a shutdown/reboot
with no way to differentiate the operation.

Is there a hidden way to perform what I want to do or it's
Windows which is *BAD* designed ?...

TIA

Jans

Replies:

www.cryer.info
Managed Newsgroup Archive