Delphi to write background monitoring software

Source: Internet
Author: User

Background monitoring software, in order to achieve the purpose of covert monitoring, should meet the normal operation, do not appear on the taskbar, in the Ctrl+alt+del appear in the task list does not show that the administrator can pull through the hidden running interface. To do this, you must change the current process into a system service and define a global hotkey.

One, the current process into a system services:

The goal is to hide the program in the Task list. Call API function RegisterServiceProcess implementation.

Defining a global hotkey (in this case, the hotkey ctrl+del+r), step:

1, the definition captures Windows message Wm_hotkey hook function, namely: Procedure Wmhotkey (Var msg:twmhotkey); Message Wm_hotkey;

2. Add a global atomic myhotkey:globaladdatom (' Myhotkey ') to Windows and retain its handle.

3, to Windows Registration Hotkey: Invoke API function RegisterHotKey implementation.

Third, the source program:

Unit Unit1;

Interface

Uses

Windows, Messages, Forms, Dialogs, Classes, Controls, Stdctrls;

Type

TForm1 = Class (Tform)

Button1:tbutton;

Button2:tbutton;

Procedure Formcreate (Sender:tobject);

Procedure Button1Click (Sender:tobject);

Procedure Button2click (Sender:tobject);

Procedure Formclose (Sender:tobject; var action:tcloseaction);

Private

{Hotkey Identification ID}

Id:integer;

Procedure Wmhotkey (var msg:twmhotkey); Message Wm_hotkey;

{Privat-declarations}

Public

{Public-declarations}

End

Var

Form1:tform1;

Implementation

Const rsp_simple_service=1;

function registerserviceprocess (Dwprocessid, Dwtype:dword): DWord; stdcall; External ' KERNEL32. DLL ';

{$R *. DFM}

{Capturing Hotkey Messages}

Procedure Tform1.wmhotkey (var msg:twmhotkey);

Begin

If Msg. HotKey = ID Then

ShowMessage (' ctrl+alt+r key is pressed! ');

Form1. Visible: =true;

End

Procedure Tform1.formcreate (Sender:tobject);

Const

{ALT, CTRL, and R-key virtual key values}

Mod_alt = 1;

Mod_control = 2;

Vk_r = 82;

Begin

{First determine if the program is running}

If Globalfindatom (' myhotkey ') = 0 Then

Begin

{Register Global Hotkey Ctrl + ALT + R}

Id:=globaladdatom (' Myhotkey ');

RegisterHotKey (Handle,id,mod_control+mod_alt,vk_r);

End

Else

Halt

End

{Turn the current process into a system service to hide the program in the Task List}

Procedure Tform1.button1click (Sender:tobject);

Begin

RegisterServiceProcess (Getcurrentprocessid,rsp_simple_service);

Form1. Hide;

End

Procedure Tform1.button2click (Sender:tobject);

Begin

Close

End

{Free Global hotkey when exiting}

Procedure Tform1.formclose (Sender:tobject; var action:tcloseaction);

Begin

Unregisterhotkey (Handle,id);

Globaldeleteatom (ID);

End

End.

Iv. Description:

In the background monitoring software to use the above functions, can really achieve covert operation, hot key out, easy to manage management. The program runs through the win98,delphi5.0.

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.