Вверх ↑
Ответов: 1883
Рейтинг: 163
#1: 2020-09-09 15:56:57 ЛС | профиль | цитата
Понекрпостю, раз сразу не заметил.
Вот поинтереснее решение:
Add(InlineCode,10339731,252,399)
{
@Hint=#24:Глобальный перехват мыши|
EventPoints=#11:onMouseMove|13:onLButtonDown|11:onLButtonUp|13:onRButtonDown|11:onRButtonUp|11:onWheelDown|9:onWheelUp|8:onScroll|14:onX1ButtonDown|11:onX1BttonUp|14:onX2ButtonDown|11:onX2BttonUp|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|38:uses kol,Share,Debug,windows,messages;|0:|4:type|27: tagMSLLHOOKSTRUCT = record|12: pt:TPoint;|18: mouseData:dword;|14: flags:dword;|13: time:dword;|23: dwExtraInfo:^Cardinal|5: end;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|26: onMouseMove:THI_Event;|28: onLButtonDown:THI_Event;|26: onLButtonUp:THI_Event;|28: onRButtonDown:THI_Event;|26: onRButtonUp:THI_Event;|26: onWheelDown:THI_Event;|24: onWheelUp:THI_Event;|23: onScroll:THI_Event;|29: onX1ButtonDown:THI_Event;|27: onX1ButtonUp:THI_Event;|29: onX2ButtonDown:THI_Event;|27: onX2ButtonUp:THI_Event;|0:|23: constructor Create;|33: destructor Destroy; override;|0:|5: end;|0:|14:var H:THandle;|20: hac:THiAsmClass;|0:|14:implementation|0:|49:function hook(code,w,l:integer):Lresult; stdcall;|15:var str:string;|25: ll:tagMSLLHOOKSTRUCT;|15: d:LongWord;|5:begin|38: ll := tagMSLLHOOKSTRUCT(pointer(l)^);|0:|26: d := ll.mouseData shr 16;|46: if d and $8000 <> 0 then d := d or $FFFF0000;|0:|10: case w of|36: 512: _hi_OnEvent(hac.onMouseMove);|38: 513: _hi_OnEvent(hac.onLButtonDown);|36: 514: _hi_OnEvent(hac.onLButtonUp);|38: 516: _hi_OnEvent(hac.onRButtonDown);|36: 517: _hi_OnEvent(hac.onRButtonUp);|36: 519: _hi_OnEvent(hac.onWheelDown);|34: 520: _hi_OnEvent(hac.onWheelUp);|45: 522: _hi_OnEvent(hac.onScroll, int2str(d));|12: 523: begin|17: case d of|44: 1: _hi_OnEvent(hac.onX1ButtonDown);|44: 2: _hi_OnEvent(hac.onX2ButtonDown);|12: end;|11: end;|12: 524: begin|17: case d of|42: 1: _hi_OnEvent(hac.onX1ButtonUp);|42: 2: _hi_OnEvent(hac.onX2ButtonUp);|12: end;|11: end;|5: end;|38: result := CallNextHookEx(H,code,w,l);|4:end;|0:|31:constructor THiAsmClass.Create;|5:begin|18: inherited Create;|13: hac := self;|48: H := SetWindowsHookEx(14, @hook, hInstance, 0);|82: if H = 0 then messagebox(ReadHandle,'Ошибка перехвата мыши','ERROR',mb_iconhand);|4:end;|0:|31:destructor THiAsmClass.Destroy;|5:begin|24: UnhookWindowsHookEx(H);|19: inherited Destroy;|4:end;|0:|4:end.|
}

А что перестаёт работать: https://forum.hiasm.com/topic/67602.
карма: 7
0
Редактировалось 1 раз(а), последний 2020-09-09 15:57:13