最近在看线程插入实例,,,其中有一段是用HOOK截WH_MESSAGE消息的一段,没看懂,下面HOOK内容;
function GetMsgHookPro(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
///////////////////////这个位置的代码,是不是在要截获的进程中运行的呢?????我在这个位置用createthread建了一个线程,这个线程内容是在桌面上新建一个文本文件,但是为什么会出错呢???还有下面红字是实例这个位置原来的代码,,我想问为什么还要用内存映射呢,,,直接写上DLL
文件的地址不就行了,,还费那事干嘛.....  if (TheNodeP<>nil)and(TheNodeP^.ExplorerID<>0)and
     (GetCurrentProcessId=TheNodeP^.ExplorerID)then   //是资源管理器进程
  begin
    LibraryH := LoadLibrary(Pchar(TheNodeP^.MainPath+'Insert.dll'));  //装载动态链接库
    if (LibraryH <> 0) then
      ThreadPt := GetProcAddress(LibraryH, 'ThreadPro');  //定位线程函数
    if (ThreadPt <> nil) then
      CreateThread(nil, 0, ThreadPt, nil, 0, ThreadID);   //创建新线程
  end;
  Result:= CallNextHookEx(GetMsgHook, nCode, HINSTANCE, lParam);
///////////////////////
end;procedure GetMsgHookOn;
begin
  GetMsgHook := SetWindowsHookEx(WH_GETMESSAGE, @GetMsgHookPro, HInstance, 0);
end;