FUNCTION RegisterKey(key: Tshortcut): integer;
VAR
TheKey : Word;
TheShiftState : TShiftState;
state : uint;
BEGIN
Result := GlobalAddAtom(pchar(Format('Fox%d', [key])));
IF result = 0 THEN
exit;
state := 0;
ShortCutToKey(key, TheKey, TheShiftState);
IF ssShift IN TheShiftState THEN
state := state OR mod_shift;
IF ssalt IN theshiftstate THEN
state := state OR mod_alt;
IF ssctrl IN theshiftstate THEN
state := state OR MOD_CONTROL;
RegisterHotKey(handle, Result, state, thekey);