首页  编辑  

将热键转化为字符串

Tags: /超级猛料/Alogrith.算法和数据结构/杂项/   Date Created:

将Windows的Hot Key转换成字符串

function ShortCutToString(const HotKey:word):string;

var

shift:tshiftstate;

begin

 shift:=[];

 if ((wordrec(HotKey).hi shr 0) and 1)<>0 then

    include(shift,ssshift);

 if ((wordrec(HotKey).hi shr 1) and 1)<>0 then

    include(shift,ssctrl);

 if ((wordrec(HotKey).hi shr 2) and 1)<>0 then

    include(shift,ssalt);

 result:=shortcuttotext(shortcut(wordrec(hotkey).lo,shift));

end;

function ShiftStateToWord ( Shift : TShiftState ): Word ;

begin

  if ssShift in Shift then  Result := MOD_SHIFT ;

  if ssCtrl in Shift then Result := Result or MOD_CONTROL ;

  if ssAlt in Shift then Result := Result or MOD_ALT ;

end ;