消息传送 请问有什么办法能在同一应用程序里接受消息,并使某一状态随消息的改变而改变?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 定义自己的消息,和消息处理函数,在消息处理函数里改变某一状态如const mymessage = wm_user+1; TForm1 = class(TForm) private procedure ProMymessage(var msg:tmessage);message mymessage; public { Public declarations } end; procedure ProMymessage(var msg:tmessage);message mymessage;就是消息处理函数,后面要用关键字message wndproc这个函数实际上就是包含很多消息的一个case,可以考虑在里面修改 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;const wm_my = wm_user+12; ///自己定义的消息type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } procedure prowm_my(var msg:tmessage);message wm_my; //自己定义的消息的处理函数 public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.prowm_my(var msg: tmessage);var s:string;i:integer;begin for i:=1 to msg.LParam do begin s:=s+chr(pbyte(msg.WParam+i-1)^); end; showmessage(s);end;procedure TForm1.Button1Click(Sender: TObject); //发送消息同时带着pp字符串的地址和字符的个数var pp:string;begin pp:='i am a message'; sendmessage(handle,wm_my,integer(pp),length(pp));end;end. 又再遇到一个问题? 在delphi裡面怎麼取每個月的最後一天? 如何汉化fastreport? 存储过程的问题!200分! 程序里有哪麼多鬼東西。。。請問。。這有什麼用? 急求Delphi编译代码怎么显示名称呢~ mapinfo,mapx,那有帮助,如何用啊!GIS高手指点指点! 棋牌游戏求救!!! 高手来帮忙看看~ 查询字符串的问题 关于object pascal的class of class的讨论,高手请进: 一个很急的问题: 我的数据库所有汉字的部分显示的全都是"?????".在线等待 插入SQL语句查错,在线等待。
const
mymessage = wm_user+1; TForm1 = class(TForm)
private
procedure ProMymessage(var msg:tmessage);message mymessage;
public
{ Public declarations }
end;
procedure ProMymessage(var msg:tmessage);message mymessage;
就是消息处理函数,后面要用关键字message
这个函数实际上就是包含很多消息的一个case,
可以考虑在里面修改
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;const
wm_my = wm_user+12; ///自己定义的消息type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure prowm_my(var msg:tmessage);message wm_my; //自己定义的消息的处理函数
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.prowm_my(var msg: tmessage);
var s:string;i:integer;
begin
for i:=1 to msg.LParam do
begin
s:=s+chr(pbyte(msg.WParam+i-1)^);
end;
showmessage(s);
end;procedure TForm1.Button1Click(Sender: TObject); //发送消息同时带着pp字符串的地址和字符的个数
var pp:string;
begin
pp:='i am a message';
sendmessage(handle,wm_my,integer(pp),length(pp));
end;end.