接收端 接收message事件
type
TForm1 = class(TForm)
private
procedure WMMOUSEDOWN(var Msg: TMessage);message WM_LBUTTONDOWN;
procedure WM2000(var Msg: TMessage);message 2000;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WM2000(var Msg: TMessage);
begin
ShowMessage('接收到2000');
end;
procedure TForm1.WMMOUSEDOWN(var Msg: TMessage);
begin
ShowMessage('M');
end;
發送端
procedure TForm1.Button1Click(Sender: TObject);
var h:HWND;
begin
h:=FindWindow(nil,'Form1');
if h=0 then
ShowMessage('no found');
SendMessage(h,2000,2001,2002);
end;
全站熱搜
留言列表