unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
WM_MY=WM_USER+1;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure my(var MSG:TMSG);message WM_MY;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
sendmessage(handle,WM_MY,100,200);
end;procedure TForm1.my(var msg:TMSG);
begin
memo1.Lines.Add(inttostr(msg.hwnd ));
memo1.Lines.Add(inttostr(msg.message));
memo1.Lines.Add(inttostr(msg.wParam ));
memo1.Lines.Add(inttostr(msg.lParam ));
memo1.Lines.Add(datetimetostr(msg.time ));
memo1.Lines.Add(inttostr(msg.pt.X ));
memo1.Lines.Add(inttostr(msg.pt.y ));
end;end.
如上,hwnd没有值的,MEMO1中,分别是
1025
100
200
0
5301-9-14
2010220340
786490为什么会是这样的,并且,如果在两个程序间传递一个结构指针,也无法取得结构的数据?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
WM_MY=WM_USER+1;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure my(var MSG:TMSG);message WM_MY;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
sendmessage(handle,WM_MY,100,200);
end;procedure TForm1.my(var msg:TMSG);
begin
memo1.Lines.Add(inttostr(msg.hwnd ));
memo1.Lines.Add(inttostr(msg.message));
memo1.Lines.Add(inttostr(msg.wParam ));
memo1.Lines.Add(inttostr(msg.lParam ));
memo1.Lines.Add(datetimetostr(msg.time ));
memo1.Lines.Add(inttostr(msg.pt.X ));
memo1.Lines.Add(inttostr(msg.pt.y ));
end;end.
如上,hwnd没有值的,MEMO1中,分别是
1025
100
200
0
5301-9-14
2010220340
786490为什么会是这样的,并且,如果在两个程序间传递一个结构指针,也无法取得结构的数据?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货