C
CJ
Unregistered / Unconfirmed
GUEST, unregistred user!
甬到一个键盘鼠标的记录钩子,想把他封装成类,开始是如此定义的:
Type TJournalHook = Class
private
......
function PlayProc(iCode:Integer;wParam:wParam;lParam:lParam):LRESULT;stdcall;
function HookProc(iCode:Integer;wParam:wParam;lParam:lParam):LRESULT;stdcall;
public
....
end;
问题是,在实现部分安装钩子的时候出现了问题:
hHook:=SetwindowsHookEx(WH_JOURNALRECORD,HookProc,HInstance,0);
hPlay:=SetwindowsHookEx(WH_JOURNALPLAYBACK,PlayProc,HInstance,0);
编译报:Incompatible types "regular procedure and mathod pointer",明显要让我把那两个过程分离出来。
但是,分离出来以后,我需要访问本类的各个变量——私有和公有。在OBJECT PASCAL里怎么弄呢?
要是不做成类其实也没有任何问题的,不过……
Type TJournalHook = Class
private
......
function PlayProc(iCode:Integer;wParam:wParam;lParam:lParam):LRESULT;stdcall;
function HookProc(iCode:Integer;wParam:wParam;lParam:lParam):LRESULT;stdcall;
public
....
end;
问题是,在实现部分安装钩子的时候出现了问题:
hHook:=SetwindowsHookEx(WH_JOURNALRECORD,HookProc,HInstance,0);
hPlay:=SetwindowsHookEx(WH_JOURNALPLAYBACK,PlayProc,HInstance,0);
编译报:Incompatible types "regular procedure and mathod pointer",明显要让我把那两个过程分离出来。
但是,分离出来以后,我需要访问本类的各个变量——私有和公有。在OBJECT PASCAL里怎么弄呢?
要是不做成类其实也没有任何问题的,不过……