Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей.
Здесь обсуждаются безопасность, программирование, технологии и многое другое.
Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
 |
C+ Builder Как отловить завершение работы windows |

04.07.2006, 11:47
|
|
Members of Antichat - Level 5
Регистрация: 04.09.2005
Сообщений: 528
Провел на форуме: 6520559
Репутация:
2947
|
|
C+ Builder Как отловить завершение работы windows
C++ Builder 6
Как отловить завершение работы windows?
Как отловить завершение сеанса windows?
Как отловить перезагрузку и тд windows?
Что то слышал про WM_QUERYENDSESSION
Как юзать так инепонял!
|
|
|

04.07.2006, 13:09
|
|
Статус пользователя:
Регистрация: 26.07.2005
Сообщений: 568
Провел на форуме: 1290766
Репутация:
1236
|
|
Platform SDK: Windows System Information
How to Log Off the Current User
To log off the current user, call the ExitWindows or ExitWindowsEx function.
By default, when an application uses ExitWindows or ExitWindowsEx to log off, the system sends the WM_QUERYENDSESSION message to each window. Applications agree to terminate by returning TRUE when they receive this message. If any application returns FALSE, the log-off operation is canceled.
When an application returns TRUE for WM_QUERYENDSESSION, it receives the WM_ENDSESSION message and it is terminated, regardless of how the other applications respond to the WM_QUERYENDSESSION message.
Windows Me/98/95: After all applications return TRUE for WM_QUERYENDSESSION, they receive the WM_ENDSESSION and they are terminated.
To force all applications to terminate, use ExitWindowsEx, and specify the EXW_FORCE flag. This prevents the system from sending WM_QUERYENDSESSION messages.
The system also sends the CTRL_LOGOFF_EVENT control signal to every process during a log-off operation. A console application can register a HandlerRoutine to process these messages.
If the process that called ExitWindowsEx is running in the logon session of the interactive user, all processes in the logon session are terminated. If the process calling ExitWindowsEx is in some other logon session, only the notifications are made; no processes are terminated.
...собсна сабж...
__________________
 
snow white world wide
|
|
|

04.07.2006, 15:04
|
|
Members of Antichat - Level 5
Регистрация: 04.09.2005
Сообщений: 528
Провел на форуме: 6520559
Репутация:
2947
|
|
Собственно хэлп я читал но так и недопёр!
как юзать так и непонял 
|
|
|

06.07.2006, 15:07
|
|
Статус пользователя:
Регистрация: 26.07.2005
Сообщений: 568
Провел на форуме: 1290766
Репутация:
1236
|
|
добавь обработчик сообщения. как это делается в билдере 6, можно зазыреть в экзамплах. apps/trayicon.
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem)
MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify)
END_MESSAGE_MAP(TForm)
ставишь аналогичный хендлер на WM_QUERYENDSESSION.
wParam не юзается, а lParam указывает опцию логоффа.
__________________
 
snow white world wide
|
|
|

06.07.2006, 18:14
|
|
Участник форума
Регистрация: 31.08.2003
Сообщений: 177
Провел на форуме: 249275
Репутация:
22
|
|
sn0w MFC - зло, юзай винапи)
ЗЫ билдер тожа зло.
|
|
|

07.07.2006, 11:43
|
|
Members of Antichat - Level 5
Регистрация: 04.09.2005
Сообщений: 528
Провел на форуме: 6520559
Репутация:
2947
|
|
Спасиб!!!
Попробую!
|
|
|
|
 |
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|