背景:
阅读新闻

如何记录QQ聊天记录

[日期:2008-12-17] 来源:  作者:admin [字体: ]
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:
收藏 推荐 打印 | 录入:admin | 阅读:
相关新闻      
本文评论   [发表评论]   全部评论 (1)
第 1 楼
sqzhao1会员 发表于 2010/1/16 9:38:51
uuuuuuuuu
热门评论