DELPHI 传递的消息中的问题,为什么用不了TMSG 很菜,谢谢

lucom11 2007-10-20 10:29:39
unit Unit1;

interface

uses
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

为什么会是这样的,并且,如果在两个程序间传递一个结构指针,也无法取得结构的数据?
...全文
143 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
knowledge_Is_Life 2008-05-01
  • 打赏
  • 举报
回复
有点难度哦
UltraBejing 2008-04-30
  • 打赏
  • 举报
回复
lz要干嘛?

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧