function GetModuleHandleFromInstance: THandle;
var
s: array[0..512] of char;
begin
GetModuleFileName(hInstance, s, sizeof(s)-1);
Result := GetModuleHandle(s);
end;调用的时候有两种
一种是: SetWindowsHookEx(WH_mouse, HookHandler, HInstance, 0);
另一种是利用上面的函数 SetWindowsHookEx(WH_mouse, HookHandler, GetModuleHandleFromInstance, GetCurrentThreadID); 我想问问谁能帮我解释一下这段代码
var
s: array[0..512] of char;
begin
GetModuleFileName(hInstance, s, sizeof(s)-1);
Result := GetModuleHandle(s);
end;调用的时候有两种
一种是: SetWindowsHookEx(WH_mouse, HookHandler, HInstance, 0);
另一种是利用上面的函数 SetWindowsHookEx(WH_mouse, HookHandler, GetModuleHandleFromInstance, GetCurrentThreadID); 我想问问谁能帮我解释一下这段代码
var
s: array[0..512] of char;
begin
GetModuleFileName(hInstance, s, sizeof(s)-1); //取当前实例的文件名
Result := GetModuleHandle(s); //通过文件取得取模块句柄
end;
SetWindowsHookEx(WH_mouse, HookHandler, HInstance, 0);
or
SetWindowsHookEx(WH_mouse, HookHandler, GetModuleHandleFromInstance, GetCurrentThreadID); //第三个参数是钩子处理函数所处模块的句柄;第四个参数是指定被监视的线程
//如果第四个参数是 0 (NULL) (有时要钩子处理过程在DLL里面)则表示监视系统里面所有的进程结贴给分谢谢
我想知道的是这里面所说的“钩子处理函数所处模块的句柄”
是否是指调用这个dll文件的那个应用程序的句柄呢?