![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
Q: Prevent Windows from shutting downAnswerRespond to the WM_QUERYENDSESSION and return 0. //---------------------------------------------------------- // unit1.h class TForm1 : public TForm { __published: // IDE-managed Components private: // User declarations void __fastcall WMQueryEndSession(TWMQueryEndSession &msg); public: // User declarations __fastcall TForm1(TComponent* Owner); BEGIN_MESSAGE_MAP MESSAGE_HANDLER(WM_QUERYENDSESSION,TWMQueryEndSession,WMQueryEndSession) END_MESSAGE_MAP(TForm) }; //---------------------------------------------------------- //---------------------------------------------------------- // unit1.cpp void __fastcall TForm1::WMQueryEndSession(TWMQueryEndSession &msg) { msg.Result = 0; ShowMessage("Sorry, my parents won't let you close"); } | ||||||
All rights reserved. |