Delphi-Quellcode:
library hotlock;
uses
windows,
Messages,
SysUtils;
type
TDummy = class
private
id1: Integer;
procedure WMHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
public
procedure Keybind1;
procedure EnableHotKey;
procedure DisableHotKey;
end;
var
Dummy: TDummy;
Msg: TMsg;
procedure TDummy.WMHotKey(var Msg: TWMHotKey);
begin
if Msg.HotKey = id1 then
Dummy.Keybind1;
end;
procedure TDummy.Keybind1;
begin
MessageBox(0, 'KEYBIND1 was captured', 'SUCCESS!', 0);
end;
procedure TDummy.EnableHotKey;
begin
//Globally trap the Windows system key "PrintScreen"
id1 := GlobalAddAtom('Hotkey1');
RegisterHotKey(0, id1, 0, VK_END);
end;
procedure TDummy.DisableHotKey;
begin
//Unregister the Hotkey
UnRegisterHotKey(0, id1);
GlobalDeleteAtom(id1);
end;
begin
Dummy := Tdummy.Create;
Dummy.EnableHotKey;
while GetMessage(Msg, 0, 0, 0) do begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
dummy.DisableHotKey;
dummy.Free;
{
while GlobalFindAtom('Hotkey1') <> 0 do
GlobalDeleteAtom(GlobalFindAtom('Hotkey1'));
}
end.
so, aber die host app wird eingefrorren.
obwohl der hotkey funken muss, weil er net mehr im explorer zb funkt.
//edit:
globalkeyhook ist mein freund

da das ganze ja ne '
dll' ist. mal sehen, was meister google und meister forensuche mir verraten