用RegisterHotKey可以给控键注册多个热键吗?(如不可以怎么实现呢?) 早上brightyang帮我解决的注册热键盘的问题,在这里谢谢他了。但是又有新的问题我用RegisterHotKey不能给组键注册多个热键的。不知道这个是要怎么实现,能不能给我指点指点各位大大。代码如下,但是不能实现。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;typeTForm1 = class(TForm)CheckBox1: TCheckBox;CheckBox2: TCheckBox;procedure FormCreate(Sender: TObject);procedure FormDestroy(Sender: TObject);procedure CheckBox1Click(Sender: TObject);protectedprocedure hotykey(var msg:TMessage); message WM_HOTKEY;end;varForm1: TForm1;HotKey:Integer;hw:hwnd;pid: hwnd;hProcess: hwnd;Num: Cardinal;implementation{$R *.DFM}procedure TForm1.hotykey(var msg:TMessage);beginif (msg.LParamLo=MOD_ALT) and (msg.LParamHi=VK_F8) thencheckbox1.Checked:=not checkbox1.Checkedend;procedure TForm1.FormCreate(Sender: TObject);beginhw:=findwindow(nil,'readme22.txt - 记事本');HotKey:=GlobalAddAtom('HotKey');RegisterHotKey(handle,HotKey,0,VK_F8);RegisterHotKey(handle,HotKey,MOD_ALT,VK_F8);end;procedure TForm1.FormDestroy(Sender: TObject);beginUnRegisterHotKey(handle,HotKey);end;procedure TForm1.CheckBox1Click(Sender: TObject);begin GetWindowThreadProcessId(hw, @pid); if checkbox1.Checked then showwindow(hw,SW_HIDE) else showwindow(hw,SW_SHOW);end;end. RegisterHotKey的第2个参数对应WM_HOTKEY消息的wParam参数所以你不能HotKey:=GlobalAddAtom( "HotKey "); RegisterHotKey(handle,HotKey,0,VK_F8); RegisterHotKey(handle,HotKey,MOD_ALT,VK_F8); 要分开申请HotKey1:=GlobalAddAtom('HotKey1'); RegisterHotKey(handle,HotKey1,0,VK_F8); HotKey2:=GlobalAddAtom('HotKey2'); RegisterHotKey(handle,HotKey2,MOD_ALT,VK_F8); procedure TForm1.hotykey(var msg:TMessage); begin if msg.wParam =HotKey1 then;......if msg.wParam =HotKey2 then;......end; D7+CR11 如何打包发布 求delphi6.0的下载地址,不要7.0的有的朋友告诉我下,谢谢。 求IVR源码(急!!!!) 高手请进,我一个问题请教诸位老大!!!!!, 我用TMediaPlayer录制wav文件,却不能播放,报告为不能识别的格式 友类的一个用处! QRStringsBand 用法,ITEM 谢谢,马上给分 delphi如何限制扫描枪仅当焦点在文本软件框时有效而在按钮上时无效 这个表格的SQL语句如何写啊! Indy9 模拟Post报错http 1.1 400 bad request 读写类似表结构的txt 请问各位如何处理N个客户端连接的问题?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
protected
procedure hotykey(var msg:TMessage); message WM_HOTKEY;
end;var
Form1: TForm1;
HotKey:Integer;
hw:hwnd;
pid: hwnd;
hProcess: hwnd;
Num: Cardinal;
implementation{$R *.DFM}
procedure TForm1.hotykey(var msg:TMessage);
begin
if (msg.LParamLo=MOD_ALT) and (msg.LParamHi=VK_F8) then
checkbox1.Checked:=not checkbox1.Checked
end;procedure TForm1.FormCreate(Sender: TObject);
begin
hw:=findwindow(nil,'readme22.txt - 记事本');
HotKey:=GlobalAddAtom('HotKey');
RegisterHotKey(handle,HotKey,0,VK_F8);
RegisterHotKey(handle,HotKey,MOD_ALT,VK_F8);
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
UnRegisterHotKey(handle,HotKey);
end;procedure TForm1.CheckBox1Click(Sender: TObject);
begin
GetWindowThreadProcessId(hw, @pid);
if checkbox1.Checked then
showwindow(hw,SW_HIDE)
else
showwindow(hw,SW_SHOW);
end;end.
WM_HOTKEY消息的wParam参数
所以你不能
HotKey:=GlobalAddAtom( "HotKey ");
RegisterHotKey(handle,HotKey,0,VK_F8);
RegisterHotKey(handle,HotKey,MOD_ALT,VK_F8);
要分开申请
HotKey1:=GlobalAddAtom('HotKey1');
RegisterHotKey(handle,HotKey1,0,VK_F8);
HotKey2:=GlobalAddAtom('HotKey2');
RegisterHotKey(handle,HotKey2,MOD_ALT,VK_F8); procedure TForm1.hotykey(var msg:TMessage);
begin
if msg.wParam =HotKey1 then;
...
...
if msg.wParam =HotKey2 then;
...
...
end;