首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

sendmessage无法跟踪进函数解决办法

2012-02-25 
sendmessage无法跟踪进函数 - C++ Builder / Windows SDK/APIvoid __fastcall OnSendFileList(TMessage &M

sendmessage无法跟踪进函数 - C++ Builder / Windows SDK/API
void __fastcall OnSendFileList(TMessage &Msg);

BEGIN_MESSAGE_MAP
  VCL_MESSAGE_HANDLER(WM_SENDFILELIST, TMessage, OnSendFileList)
  VCL_MESSAGE_HANDLER(WM_SENDFILESTATUS, TMessage, OnSendFileStatus)
  VCL_MESSAGE_HANDLER(WM_RECEIVEREPLY, TMessage, OnReceiveReplay)
  VCL_MESSAGE_HANDLER(WM_BINDERROR, TMessage, OnBindError)
  VCL_MESSAGE_HANDLER(WM_LISTENERROR, TMessage, OnListenError)
  VCL_MESSAGE_HANDLER(WM_STARTLISTEN, TMessage, OnStartListen)
END_MESSAGE_MAP(TForm)

void __fastcall TfrmSendFile::OnStartListen(TMessage &Msg)
{
  ShowMessage('a');
  return;
}

我是这样定义的消息,但调试时,进不了函数里边,不知道为什么?



[解决办法]

C/C++ code
//做了个测试没问题void __fastcall TForm1::Button5Click(TObject *Sender){  SendMessage((HWND)this->Handle ,WM_STARTLISTEN, 100, NULL );}//hconst DWORD WM_STARTLISTEN = WM_USER+ 100;class TForm1 : public TForm{__published:    // IDE-managed Components    TButton *Button5;    void __fastcall Button5Click(TObject *Sender);private:    // User declarations    void __fastcall OnStartListen(TMessage &Msg);    BEGIN_MESSAGE_MAP                VCL_MESSAGE_HANDLER(WM_STARTLISTEN, TMessage, OnStartListen)END_MESSAGE_MAP(TForm)
[解决办法]
你要确认向Form窗口发送了WM_STARTLISTEN消息。

热点排行