delphi中如何定义热键?
我现在有这样一段代码,private{Privatedeclarations}procedureWmHotKey(varmsg:TMessage);messageWM_H...
我现在有这样一段代码,
private
{ Private declarations }
procedure WmHotKey(var msg:TMessage);message WM_HOTKEY;
public
{ Public declarations }
end;
var
Form1: TForm1;
const
ALT_CTRL_L :Integer =$0002;
begin
if not RegisterHotKey(Self.Handle,ALT_CTRL_L,MOD_ALT or MOD_CONTROL,$4c) then
MessageDlg('注册热键失败',mtError,[mbOk],0);
procedure TForm1.FormDestroy(Sender: TObject);
begin
if not UnRegisterHotKey(Self.Handle,ALT_CTRL_L) then
MessageDlg('撤销热键失败',mtError,[mbOk],0);
end;
procedure TForm1.WmHotKey(var msg: TMessage);
begin
if msg.WParam = ALT_CTRL_L then form1.Show;
end;
end.
现在我想换成别的热键,如何换啊,也就是说那个值“alt+ctrl+想用的键子”如何取啊? 展开
private
{ Private declarations }
procedure WmHotKey(var msg:TMessage);message WM_HOTKEY;
public
{ Public declarations }
end;
var
Form1: TForm1;
const
ALT_CTRL_L :Integer =$0002;
begin
if not RegisterHotKey(Self.Handle,ALT_CTRL_L,MOD_ALT or MOD_CONTROL,$4c) then
MessageDlg('注册热键失败',mtError,[mbOk],0);
procedure TForm1.FormDestroy(Sender: TObject);
begin
if not UnRegisterHotKey(Self.Handle,ALT_CTRL_L) then
MessageDlg('撤销热键失败',mtError,[mbOk],0);
end;
procedure TForm1.WmHotKey(var msg: TMessage);
begin
if msg.WParam = ALT_CTRL_L then form1.Show;
end;
end.
现在我想换成别的热键,如何换啊,也就是说那个值“alt+ctrl+想用的键子”如何取啊? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询