Вверх ↑
Ответов: 5227
Рейтинг: 587
#1: 2023-03-16 11:01:32 ЛС | профиль | цитата
Код не мой. Автор Иван

Add(MainForm,13376086,266,210)
{
Point(onClose)
Point(onKeyDown)
link(onCreate,2317400:SetHook,[])
link(onClose,2317400:UnHook,[])
}
Add(InlineCode,2317400,308,224)
{
WorkPoints=#7:SetHook|6:UnHook|
EventPoints=#7:onKeyUp|9:onKeyDown|10:onSysKeyUp|12:onSysKeyDown|8:onRepeat|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|38:uses kol,Share,Debug,Windows,Messages;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|40: procedure onKey(param,code:integer);|9: public|65: onKeyUp,onKeyDown,onSysKeyUp,onSysKeyDown,onRepeat:THI_Event;|4: |46: procedure SetHook(var dt:TData; Idx:WORD);|45: procedure UnHook(var dt:TData; Idx:WORD);|5: end;|0:|14:implementation|0:|5:const|21: WH_KEYBOARD_LL = $D;|22: KBH_KEYREPEAT = $DD;|4:var |12: Hook:HHOOK;|45: ret:procedure(param,code:integer) of object;|0:|4:type|24: LLKBH_STRUCT = record|11: vkCode,|13: ScanCode,|10: Flags,|15: Time:DWORD;|23: dwExtraInfo:PDWORD;|7: end;|33: PLLKBH_STRUCT = ^LLKBH_STRUCT;|1: |28:var kbh_struct:LLKBH_STRUCT;|0:|82:function HookProc(Code: integer; wParam:integer;lParam: LongInt): HRESULT;stdcall;|21:var kbh:LLKBH_STRUCT;|5:begin|44: kbh:=LLKBH_STRUCT(PLLKBH_STRUCT(lParam)^); |122: if (kbh_struct.vkCode = 0) and (kbh_struct.ScanCode = 0) and (kbh_struct.Flags = 0) then ret(wParam,kbh_struct.vkCode); |44: if kbh.Flags <> kbh_struct.Flags then begin|37: kbh_struct:=PLLKBH_STRUCT(lParam)^; |31: ret(wParam,kbh_struct.vkCode);|51: end else ret(KBH_KEYREPEAT,kbh_struct.vkCode); |55: result := CallNextHookEx(Hook, Code, wParam , lParam);|4:end;|0:|30:procedure THiAsmClass.SetHook;|5:begin|25: with kbh_struct do begin|12: vkCode:=6;|14: ScanCode:=6;|11: Flags:=5;|5: end;|12: ret:=onKey;|64: Hook := SetWindowsHookEx(WH_KEYBOARD_LL,@HookProc,HInstance,0);|4:end;|0:|28:procedure THiAsmClass.onKey;|5:begin|16: Case Param of|45: WM_KEYDOWN :_hi_OnEvent(onKeyDown,code);|43: WM_KEYUP :_hi_OnEvent(onKeyUp,code);|48: WM_SYSKEYDOWN:_hi_OnEvent(onSysKeyDown,code);|46: WM_SYSKEYUP :_hi_OnEvent(onSysKeyUp,code);|44: KBH_KEYREPEAT:_hi_OnEvent(onRepeat,code);|9: end; |4:end;|0:|29:procedure THiAsmClass.UnHook;|5:begin|27: UnhookWindowsHookEx(Hook);|4:end;|0:|4:end.|
link(onKeyUp,3658577:doWork1,[])
link(onKeyDown,3658577:doWork2,[])
link(onSysKeyUp,3658577:doWork3,[])
link(onSysKeyDown,3658577:doWork4,[])
link(onRepeat,3658577:doWork5,[])
}
Add(ListBox,11565061,532,189)
{
Left=125
Top=35
Width=205
Height=180
}
Add(StrList,4095676,434,182)
{
Strings=#15:Опущена клавиша|14:Нажата клавиша|25:Опущена системная клавиша|24:Нажата системная клавиша|20:Удерживается клавиша|
Point(doGetString)
Point(onGetString)
link(onGetString,9575750:doString,[])
}
Add(ChanelToIndex,3658577,357,224)
{
Count=5
Point(Data)
link(onIndex,4095676:doGetString,[])
}
Add(FormatStr,9575750,476,189)
{
link(onFString,11565061:doAdd,[])
link(Str2,3658577:Data,[(489,177)(426,177)(426,268)(363,268)])
}

карма: 4
Мой форум - http://hiasm.bbtalk.me/ схемы, компоненты...
0