unit UnitMain;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs,tlhelp32, ExtCtrls, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Timer1: TTimer;<br> Edit1: TEdit;<br> Label10: TLabel;<br> Label1: TLabel;<br> Label3: TLabel;<br> Label4: TLabel;<br> Label31: TLabel;<br> Label32: TLabel;<br> Label5: TLabel;<br> Label8: TLabel;<br> Label13: TLabel;<br> Label2: TLabel;<br> Label6: TLabel;<br> Label7: TLabel;<br> GroupBox1: TGroupBox;<br> Edit2: TEdit;<br> Edit3: TEdit;<br> Label9: TLabel;<br> Label11: TLabel;<br> procedure FormClose(Sender: TObject; var Action: TCloseAction);<br> procedure Timer1Timer(Sender: TObject);<br> private<br> procedure WMMsg(var message:TMessage);Message wm_user;<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br> procedure InstallDll(path:string;MainFormHandle,ExplorerProcessID:THandle;num,lSAddress,lEAddress:Cardinal);stdcall;external 'install.dll';<br> procedure RemoveDll;stdcall;external 'install.dll';<br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>function FindProcessName:THandle;<br>var<br> lppe: tprocessentry32;<br> sshandle: thandle;<br> found: boolean;<br>begin<br> result:=0;<br> sshandle := createtoolhelp32snapshot(TH32CS_SNAPALL, 0);<br> found := process32first(sshandle, lppe);<br> while found do<br> begin<br>// if ansiCompareText(ExtractFileName(lppe.szExefile),'EXPLORER.EXE') = 0 then<br> if ansiCompareText(ExtractFileName(lppe.szExefile),'QQ.exe') = 0 then<br> begin<br> result:=lppe.th32ProcessID;<br><br> break;<br> end;<br> found := process32next(sshandle, lppe); {检索下一个进程}<br> end;<br> CloseHandle(sshandle);<br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br> h: THandle;<br> num: Cardinal;<br> lSAddress,lEAddress:Cardinal;<br>begin<br> h:=FindProcessName;<br> if h=0 then begin<br>ShellExecute(0,'open','C:/Program Files/QQ/QQ.exe',nil,nil,sw_hide); end;<br> end;<br>end;<br><br><br>end.