The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message. The PostMessage function, in contrast, posts a message to a thread's message queue and returns immediately. LRESULT SendMessage( HWND hWnd, // handle of destination window
UINT Msg, // message to send
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
ParametershWndIdentifies the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows. MsgSpecifies the message to be sent. wParamSpecifies additional message-specific information. lParamSpecifies additional message-specific information. Return ValuesThe return value specifies the result of the message processing and depends on the message sent.
UINT Msg, // message to send
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
ParametershWndIdentifies the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows. MsgSpecifies the message to be sent. wParamSpecifies additional message-specific information. lParamSpecifies additional message-specific information. Return ValuesThe return value specifies the result of the message processing and depends on the message sent.
解决方案 »
- "吉林大学地理信息系统-完整源代码" 下不了
- cxGrid第一列加入CheckBox的问题
- 我写的程序,连接数据库时,提示是病毒攻击,怎么回事???
- 请问RAS拨号中具体的TRASDIALPARAMS的结构?
- 怎样在Delphi当中获得Sql—server2000中表的PramaryKey,Index和字段的Not Null属性值,下面两个我已经知道DataType(数据类型)和Size(
- 单位买复印机,请问什么型号的好一些?
- 现在我需要快捷键方式,用HOOK有缺陷,在操作别的程序时,也会响应;用MainMenu时候又没有我想要的Ctrl+F4, 怎么办
- 没什么事,只是为了让大家认识我----------散分
- SPCOMM中procedure ReceiveData(Sender: TObject; Buffer: Pointer;BufferLength: Word);再发
- 如何通过ms proxy server来编程实现流量统计?
- 窗体的windowstate=wsmaximized,但窗体不能最大,怎样做?
- Google給我的回信。55555!!!
如下:
const
MyMsg = WM_USER+ 20;....procedure TForm1.button1Click(Sender: TObject);
begin
SendMessage(Form2.handle, MyMsg, 0 ,0);
end;...TForm2 = class(TForm)
..
private
procedure ProccessMyMsg(var Msg: TMessage);message MyMsg;
end;procedure TForm2.ProcessMyMsg(var Msg: TMessage);
begin
showmessage('这是我的消息');
end;给我分吧.
MyMsg = WM_USER+ 20;
写在那儿,曾么老是有错:
[Error] CommTest.pas(17): Undeclared identifier: 'MyMsg'
把ProccessMyMsg()名称改为MyMsg 即可运行。
注:win98,delphi5下测试通过
unit unit2interfaceuses
....;const MyMsg = WM_USER + 20;type
TForm2 = class(TForm)
...
end;.....
然后你在form1中加入unit2单元即可.
uses unit2;
.....