Add(MainForm,3921136,308,126) { Point(PHandle) link(onCreate,8770334:SetRawInput,[(352,146)(352,181)(296,181)(296,216)]) } Add(InlineCode,8770334,308,210) { WorkPoints=#11:SetRawInput| EventPoints=#9:onKeyDown|7:onKeyUp|8:onRepeat|12:onMouseEvent|0:| VarPoints=#1:X|1:Y|5:Flags|6:BFlags| DataPoints=#7:Control| Code=#15:unit HiAsmUnit;|0:|9:interface|0:|45:uses kol,Share,Debug,Windows,RInput,Messages;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|26: OldMessage:TOnMessage;|18: ctrl:PControl;|17: key,mes:UINT;|33: mx,my,_flags,_bflags:integer;|4: |68: function onMessage( var Msg: TMsg; var Rslt: Integer ): Boolean;|10: public |4: |62: Control,onKeyDown,onKeyUp,onRepeat,onMouseEvent:THI_Event;|3: |50: procedure SetRawInput(var dt:TData; Idx:WORD);|40: procedure X(var dt:TData; Idx:WORD);|40: procedure Y(var dt:TData; Idx:WORD);|44: procedure Flags(var dt:TData; Idx:WORD);|45: procedure BFlags(var dt:TData; Idx:WORD);|5: end;|0:|14:implementation|0:|34:procedure THiAsmClass.SetRawInput;|38:var rid:array[0..1] of RAWINPUTDEVICE;|5:begin|43: ctrl:=PControl(ReadInteger(dt,Control));|32: OldMessage := ctrl.OnMessage;|35: Ctrl.OnMessage := onMessage; |27: RID[0].usUsagePage := 1;|27: RID[0].usUsage := 6;|40: RID[0].dwFlags := RIDEV_NOLEGACY;|38: RID[0].hwndTarget := Ctrl.Handle; |27: RID[1].usUsagePage := 1;|27: RID[1].usUsage := 2;|41: RID[1].dwFlags := RIDEV_INPUTSINK;|40: RID[1].hwndTarget := Ctrl.Handle; |58: RegisterRawInputDevices(@RID,2,SizeOf(RAWINPUTDEVICE));|5:end; |0:|76:function THiAsmClass.onMessage( var Msg: TMsg; var Rslt: Integer ): Boolean;|6:const |22: WM_INPUT = $00FF;|17:var RI:RAWINPUT;|12: s:UINT;|15: t,f:TData;|5:begin|30:if Msg.message = WM_INPUT then|14: begin |22: s:=SizeOf(RAWINPUT);|81: GetRawInputData(HRAWINPUT(Msg.lParam),RID_HEADER,@RI,s,SizeOf(RAWINPUTHEADER));|27: case Ri.Header.dwType of |20: RIM_TYPEKEYBOARD:|9: begin|83: GetRawInputData(HRAWINPUT(Msg.lParam),RID_INPUT,@RI,s,SizeOf(RAWINPUTHEADER));|114: if (key = RI.keyboard.vKey) and (mes = RI.keyboard.message) then _hi_OnEvent(onRepeat, RI.keyboard.vKey) else|33: case RI.keyboard.message of|58: WM_KEYDOWN:_hi_OnEvent(onKeyDown,RI.keyboard.vKey);|55: WM_KEYUP: _hi_OnEvent(onKeyUp,RI.keyboard.vKey);|10: end;|8: end;|18: RIM_TYPEMOUSE: |9: begin|83: GetRawInputData(HRAWINPUT(Msg.lParam),RID_INPUT,@RI,s,SizeOf(RAWINPUTHEADER));|32: _flags := ri.Mouse.usFlags;|45: _bflags := ri.Mouse.union.usButtonFlags;|30: mx := ri.mouse.lLastX; |29: mY := ri.mouse.lLastY; |30: _hi_OnEvent(onMouseEvent);|8: end;|7: end; |27: key := RI.keyboard.vKey;|30: mes := RI.keyboard.message;|4:end;|45:Result := _hi_OnMessage(OldMessage,Msg,Rslt);|4:end;|0:|24:procedure THiAsmClass.X;|5:begin|18: dtInteger(dt,mx);|5:end; |0:|24:procedure THiAsmClass.Y;|5:begin|18: dtInteger(dt,my);|5:end; |0:|28:procedure THiAsmClass.Flags;|5:begin|22: dtInteger(dt,_flags);|5:end; |0:|29:procedure THiAsmClass.BFlags;|5:begin|23: dtInteger(dt,_bflags);|5:end; |0:|4:end.| link(onKeyDown,7930936:doWork1,[]) link(onKeyUp,7930936:doWork2,[]) link(onRepeat,7930936:doWork3,[]) link(Control,3921136:PHandle,[]) link(onMouseEvent,393041:doBits,[(352,237)(352,289)(317,289)(317,342)]) } Add(ChanelToIndex,7930936,420,210) { Count=3 Point(Data) link(onIndex,7108844:doGetString,[(460,216)(460,251)]) } Add(StrList,7108844,469,203) { Strings=#14:Нажата клавиша|15:Опущена клавиша|20:Удерживается клавиша| Point(doGetString) Point(onGetString) link(onGetString,3750159:doString,[]) } Add(FormatStr,3750159,518,210) { link(onFString,7567543:doWork2,[]) link(Str2,7930936:Data,[(531,198)(561,198)(561,267)(426,267)]) } Add(ListBox,15090687,588,210) { Left=50 Top=60 Width=130 Height=200 Align=5 AddType=1 } Add(IntToBits,393041,329,336) { ZeroBits=1 link(Value,8770334:BFlags,[]) link(onBit1,14212637:doWork1,[]) link(onBit2,14212637:doWork2,[]) link(onBit3,8713920:doWork1,[]) link(onBit4,8713920:doWork2,[]) } Add(ChanelToIndex,14212637,378,336) { link(onIndex,1227553:doGetString,[]) } Add(ChanelToIndex,8713920,420,350) { } Add(StrList,1227553,476,294) { Strings=#24:Нажата левая кнопка мыши|26:Отпущена левая кнопка мыши| Point(doGetString) Point(onGetString) link(onGetString,7108463:doWork2,[]) } Add(HubEx,7567543,567,210) { link(onEvent,15090687:doAdd,[]) } Add(HubEx,7108463,567,301) { Angle=3 link(onEvent,7567543:doWork3,[]) }