Delphi编程:QQ聊天记录怎样被记录下来(2)
中华网科技 http://tech.china.com
2005-07-25 10:37:44
|
|
|
DLL单元代码
var
MemFile: THandle;
Shared: PShared;
function ShellProc(iCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
case iCode of
HSHELL_WINDOWCREATED:
//有顶级窗口创建时向演示程序发送自己定义消息WM_USERCMD. Wparamr参数说明
// wParam specifies the handle of the window being created or destroyed, respectively.
PostMessage(Shared^.MainWnd,WM_USERCMD ,UC_WINCREATE,wParam);
end;
Result := CallNextHookEx(Shared^.ShellHook,iCode,wParam,lParam);
end;
function InstallHook:Boolean;
begin
Shared^.Moudle:=GetModuleHandle(PChar(‘qqhook‘)); //qqhook是我的DLL文件名.
Shared^.ShellHook := SetWindowsHookEx(WH_SHELL,
@ShellProc,
Shared^.Moudle,
0);
if Shared^.ShellHook = 0 then
begin
Result := False;
Exit;
end;
Result := true;
end;
{撤消钩子过滤函数}
function UninstallHook: Boolean;
begin
Freelibrary(Shared^.Moudle);
Result:=UnHookWindowsHookEx(Shared^.ShellHook);
UnmapViewOfFile(Shared);
CloseHandle(memFile);
end;
procedure DllEntry(dwReason : integer);
begin
case dwReason Of
DLL_PROCESS_ATTACH:
首页 上页 | 1 | 2 | 3 | 4 | 下页 尾页 共 4 页
|