要处理消息 首先要知道要处理的消息的消息号是什么 然后针对这个消息写处理函数即可<br>unit Unit1;<br>//处理消息的单元<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;<br><br>type<br> TForm_czx = class(TForm)<br> private<br> { Private declarations }<br> public<br> procedure OnMessage100(var Message: TMessage);message WM_USER+610;<br> { Public declarations }<br> end;<br><br>var<br> Form_czx: TForm_czx;<br><br>implementation<br><br>{$R *.DFM}<br><br>{ TForm1 }<br><br>procedure TForm_czx.OnMessage100(var Message: TMessage);<br>begin<br> ShowMessage('aaa');<br> Message.Result:=100;<br>end;<br><br>end.<br><br><br><br><br>unit Unit2;<br>//发消息的单元<br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> hd:HWND;<br>begin<br> hd:=FindWindow('TForm_czx', nil);<br> if hd=0 then Exit;<br> if Sendmessage(hd,WM_USER+610,0,0)=100 then<br> begin<br> ShowMessage('1000');<br> end;<br>end;<br><br>end.