var
HotKey : HATOM;
procedure
TForm1
.
CheckBox1Click(Sender: TObject);
begin
if
CheckBox1
.
Checked
then
begin
HotKey := GlobalAddAtom(
'Hotkey1'
);
RegisterHotKey(Handle, HotKey,
0
, VK_F2);
end
else
begin
UnRegisterHotKey(Handle, HotKey);
GlobalDeleteAtom(HotKey);
end
;
end
;
procedure
Tfunk
.
WMHotKey (
var
Msg : TWMHotKey);
begin
if
msg
.
HotKey = HotKey
then
keybd_event(
50
,
0
,
0
,
0
);
if
msg
.
HotKey = HotKey
then
keybd_event(
51
,
0
,
0
,
0
);
if
msg
.
HotKey = HotKey
then
keybd_event(
52
,
0
,
0
,
0
);
if
msg
.
HotKey = HotKey
then
keybd_event(
50
,
0
, keyeventf_keyup,
0
);
if
msg
.
HotKey = HotKey
then
keybd_event(
51
,
0
, keyeventf_keyup,
0
);
if
msg
.
HotKey = HotKey
then
keybd_event(
52
,
0
, keyeventf_keyup,
0
);
end
;