c++builder 重载WindowProc、WndProc 截获消息 方法一WindowProc void __fastcall myWindowProc(Messages::TMessage &msg); //增加
void __fastcall TForm1::myWindowProc(Messages::TMessage &msg) else void __fastcall TForm1::FormCreate(TObject *Sender) OldWindowProc=Edit1->WindowProc; 方法二 MESSAGE_MAP class TForm1 : public TForm MESSAGE_HANDLER(WM_MOUSEWHEEL, TMessage, OnEditMouseWell) END_MESSAGE_MAP(TForm) //TForm 换成TEdit public: // User declarations void __fastcall TForm1::OnEditMouseWell(TMessage &msg)
} 方法三 重载 WndProc private: // User declarations
void __fastcall TForm1::WndProc(Messages::TMessage &msg) 四、ApplicationEvents控件 窗体上放置ApplicationEvents1控件,在ApplicationEvents1Message事件里判断。 void __fastcall TForm3::ApplicationEvents1Message(tagMSG &Msg, bool &Handled) { if (Msg.hwnd == this->DBGrid1->Handle && Msg.message == WM_MOUSEWHEEL) this->Caption = Now(); } http://www.cnblogs.com/cb168/p/4705059.html |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论