H hqpeng Unregistered / Unconfirmed GUEST, unregistred user! 1999-08-23 #1 在Another_eYes贴出的代码中,有一些尚未弄明白之处,请高手指点. 串口返回数据被自动接收后,通过postmessage发出消息,是由谁来 接收?能否由writestring过程接收?
A amo Unregistered / Unconfirmed GUEST, unregistred user! 1999-08-23 #2 BOOL PostMessage( HWND hWnd, // handle of destination window UINT Msg, // message to post WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); 发给谁,就谁收了!
BOOL PostMessage( HWND hWnd, // handle of destination window UINT Msg, // message to post WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); 发给谁,就谁收了!
H hqpeng Unregistered / Unconfirmed GUEST, unregistred user! 1999-08-23 #3 该Postmessage在DLL内部,应该将消息发给指定的函数才对,能实现吗?
X xixi Unregistered / Unconfirmed GUEST, unregistred user! 1999-08-23 #4 程序A Unit A; interface uses Windows, ShellApi, .... const WM_MYMSG = WM_APP + 400; type TFormA = class(TForm) ... protected procedure GetMyMsg(var Message: TMessage); Message WM_MYMSG; end; var FormA: TFormA; ..... procedure TFormA.GetMyMsg(var Message: TMessage); begin //接收到Message 所做的事 end; 程序B unit B; ... const WM_MYMSG = WM_APP + 400; ... procedure ... begin PostMessage(Handle, WM_MYMSG, 0, 0); //Handle指程序A中FormA窗口的句柄 //而不是程序A的句柄 end;
程序A Unit A; interface uses Windows, ShellApi, .... const WM_MYMSG = WM_APP + 400; type TFormA = class(TForm) ... protected procedure GetMyMsg(var Message: TMessage); Message WM_MYMSG; end; var FormA: TFormA; ..... procedure TFormA.GetMyMsg(var Message: TMessage); begin //接收到Message 所做的事 end; 程序B unit B; ... const WM_MYMSG = WM_APP + 400; ... procedure ... begin PostMessage(Handle, WM_MYMSG, 0, 0); //Handle指程序A中FormA窗口的句柄 //而不是程序A的句柄 end;
A Another_eYes Unregistered / Unconfirmed GUEST, unregistred user! 1999-08-23 #5 我来解答吧 前面有一句: fparenthandle := getfocus; // 取得当前窗口具有输入焦点的control的hwnd 就是发给fparenthandle的.
H hqpeng Unregistered / Unconfirmed GUEST, unregistred user! 1999-08-23 #6 在DLL中没有窗体,难道不能直接发给writestring函数吗? 那位能将本栏目中Another_eYes贴出的DLL修改后,再贴出,我再送100分 (够我攒一阵子).
C CJ Unregistered / Unconfirmed GUEST, unregistred user! 1999-08-23 #7 eYes 这个 Getfocus+postmessage骗了不少分的说