Windows Logoff C ++ Event

I need to catch the windows logoff event, I am using C ++. I don’t know where to start the search,

thanks for any help

Dani.

+3
source share
4 answers

In the console application, you can register a callback ( SetConsoleCtrlHandler, CTRL_LOGOFF_EVENT).

In a pipeline application, you can catch certain messages ( WM_QUERYENDSESSION, WM_ENDSESSION).

See Shutdown (Windows) on MSDN.

+7
source

WM_QUERYENDSESSION and WM_ENDSESSION , most likely you are after.

+4
source

OpenInputDesktop MSDN

, NULL.

: HDESK hDesk = OpenInputDesktop (0, FALSE, READ_CONTROL);

if (! hDesk)  - ... - {  - -  CloseHandle (hDesk); }

Windows Vista 7 CTRL + ALT + DELETE .

+1

Source: https://habr.com/ru/post/1758593/


All Articles