//H  File
bool
__fastcall AppHookFunc(TMessage &Message);
//cpp file
void __fastcall TForm2::FormCreate(TObject *Sender) { Application->HookMainWindow(this->AppHookFunc); } // --------------------------------------------------------------------------- void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action) { Application->UnhookMainWindow(this->AppHookFunc); } bool __fastcall TForm2::AppHookFunc(TMessage &Message) { bool Handled; switch (Message.Msg) { case WM_CLOSE: mrYes == MessageDlg("Really Close??", mtWarning, TMsgDlgButtons() << mbYes << mbNo, 0) ? Handled = false : Handled = true; break; } return Handled; }

 

posted on 2014-09-01 11:12  lypzxy  阅读(318)  评论(0编辑  收藏  举报