unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
procedure OnHotKey(var msg: TMessage); message WM_HOTKEY;
public
{ Public declarations }
end;
var
Form1: TForm1;
HotKeyId: Integer;
keyCode : Integer;
implementation
{$R *.dfm}
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
UnRegisterHotKey(handle, HotKeyId);
GlobalDeleteAtom(HotKeyId);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
keyCode := $59; //y=$59=89 a=$41=65
HotKeyId:= GlobalAddAtom('Hotkeyid') - $C000;
//RegisterHotKey(Handle, hotkeyid, MOD_CONTROL+MOD_ALT+MOD_WIN, keyCode);
Registe
Delphi 热键 | Delphi 使用WIN键作为组合热键
最新推荐文章于 2023-02-26 06:32:17 发布
本文详细介绍了如何在Delphi编程环境中利用WinAPI设置并使用WIN键与其他键组合成的热键,以实现快捷操作。通过示例代码和步骤解析,帮助开发者轻松掌握这一功能。
摘要由CSDN通过智能技术生成