Delphi off rising monitoring source code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.