如题,已经得到窗口的hwnd,用posemessage发,不要keyevent的那种,知道的说下。
在网上查资料说发不了,我想不会吧,给个代码,要delphi的
在网上查资料说发不了,我想不会吧,给个代码,要delphi的
解决方案 »
- DELPHI串口通讯的问题 请大家帮我解答一下~
- 大家天天用到但是很少有人在意的问题
- 关于面向对象的问题!
- 为什么我在2000下编译的程序在98下运行窗体的控体大小不一样?
- 我失恋了!!!!!!!!!!
- 再麻烦你看看!!!!! murphy(豆豆)
- ado中master處于新增狀態時﹐detail為和不能新增記錄﹐而BDE卻可以﹐如何做﹐能嚷ADO也可以
- 一个菜鸟的难题
- 怎么用query得到数据表的字段名?
- Delphi在Table中查找,find和locate有什么不同,为什么locate查找多字段时,只看第一个?
- 关于数据库查询的问题,请提供思路,最好有简单代码
- 请问如何查到Delphi形式的API定义?
CTRL_B=$4042;
CTRL_C=$4043;
CTRL_D=$4044;
CTRL_E=$4045;
CTRL_F=$4046;
CTRL_G=$4047;
CTRL_H=$4048;
CTRL_I=$4049;
CTRL_J=$404A;
CTRL_K=$404B;
CTRL_L=$404C;
CTRL_M=$404D;
CTRL_N=$404E;
CTRL_O=$404F;
CTRL_P=$4050;
CTRL_Q=$4051;
CTRL_R=$4052;
CTRL_S=$4053;
CTRL_T=$4054;
CTRL_U=$4055;
CTRL_V=$4056;
CTRL_W=$4057;
CTRL_X=$4058;
CTRL_Y=$4059;
CTRL_Z=$405A; //Ctrl-z
postmessage(hwnd,wm_keydown,$4046,0) 这样吗???
memo得到的消息中,第2个参数不是0,既postmessage(hwnd,wm_keydown,$4046,0)的最后这个不是0,
最后这个参数到底如何设置
procedure WndProc(var Message: TMessage); override;//改写消息传递函数//改写消息传递函数
procedure TFrm_Main.WndProc(var Message: TMessage);
begin
inherited;
case Message.Msg of
$4046://当前窗体捕获到的键盘值
begin
postmessage(hwnd,2008,0,0);//hwnd是目标窗体的handle值
end;
end;
end;
//目标窗体 //改写消息传递函数
procedure TFrm_Main.WndProc(var Message: TMessage);
begin
inherited;
case Message.Msg of
2008://当前窗体捕获到的消息ID值
begin
// 目标窗体已经捕获到消息了 在这里进行处理
end;
end;
也可以用dispach()函数向目标窗体发送消息。。
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure WndProc(var Message: TMessage); override;
procedure Button1Click(Sender: TObject);//改写消息传递函数
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure tform1.WndProc(var Message: TMessage);
begin
inherited;
case Message.Msg of
$4056://当前窗体捕获到的键盘值
begin
postmessage(memo1.Handle,2008,0,0);//hwnd是目标窗体的handle值
end;
end;
end; procedure TForm1.Button1Click(Sender: TObject);
begin
postmessage(memo1.Handle,$4056,0,0);
end;end.