sendMessage (Edit1.handle,WM_KEYDOWN,65,0);
解决方案 »
- 为什么我写的ftp客户端无法连上FTP服务器,但是用cuteftp没问题?
- f1book读取数据库的问题,hys_427请进
- ~~!!用TQuery、TDataSource这2种组件如何连接数据库?
- BMP图操作???
- 怪!真怪! ADOTable1.Filter查询 在线等待
- ListView如何实现i行与j行互换位置?
- 如何自制delphi组件?
- 怎么用Delphi来控制powerpoint呢?UP有分,不够再给~
- InfoPower大家用过吗,真是棒极了,惟一的缺陷是英文的,不能直接提交给用户,有没有汉化文件呀?
- 详细的delphi的热键
- 这个问题一直没有好的解决方法,Delphi高手请进
- 请高手帮忙将C语言转换成Delphi语言,高分奉献!!!
我现在有一个记录
type
user_recoder=recoder
a1:integer;
a2:string;
end;
假定我定义了一个wm_error_str用户消息;
在发送消息时我编程假定如下:
var j_recoder:user_recoder;
j_recoder.a1=1;
j_recoder.a2:='abc';
sendmessage(form1.handle,wm_error_str,0,intege(@j_recoder)) 问题是我在wm_error_str指定的procedure中如何把j_recoder取出来???
我的网站 www.longteng.org我的OICQ:5008022
begin
showmessage(user_recorder(message.lparam).a2)
end;
这样可以吗?
不行,因为我们以到的message.lparam是一个地址,它是一个整数
现在是如何将这个指向该记录的地址变成一个记录变量
谢谢你帮帮想想办法
newhou() 说的也可以。
copyMemory(j_recorder,message.lparam,sizeof(j_recoder));
如何将message.lparam转成指针?
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;const
CM_MY_MESSAGE=WM_USER + $100;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure CMMyMessage(var Msg:TMessage);message CM_MY_MESSAGE;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
type
TMyRecord=record
A:integer;
b:String[5];
end;procedure TForm1.CMMyMessage(var Msg: TMessage);
var
PR:^TMyRecord;
begin
PR:=Pointer(Msg.lParam);
Caption:=Format('%d,%s',[PR^.A,PR^.B]);
end;procedure TForm1.Button1Click(Sender: TObject);
var
R:TMyRecord;
begin
R.A :=5;
R.b :='Test';
SendMessage(Handle,CM_MY_MESSAGE,0,Integer(@R));
end;end.
谢谢你,同时有感谢 hjd_cw;问题解决了,我马上给分
对不起,我不知如何给分,教教,谢谢!
!!!!