delphi 调用WMI信息判断系统师傅安装杀毒软件


本文整理自网络,侵删。

 
单元:,ShlObj,ActiveX, ComObj

function IsAntivirusInstalled: Boolean;
var
    FSWbemLocator: Variant;
    FWMIService   : Variant;
    FWbemObjectSet: Variant;
    Version: TWindowsVersion;
begin 
    GetWindowsVersionEx(Version);    
    Result := false;
    FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');

    if (Version.Major = 5) and (Version.Minor = 1) then //Windows XP
      FWMIService := FSWbemLocator.ConnectServer('', 'root\SecurityCenter', '', '')
    else
    if (Version.Major = 6) then 
      FWMIService := FSWbemLocator.ConnectServer('', 'root\SecurityCenter2', '', '')
    else
    exit;

    FWbemObjectSet := FWMIService.ExecQuery('SE LE CT displayName FROM AntiVirusProduct');
    Result := (FWbemObjectSet.Count > 0);
    FWbemObjectSet := Unassigned;
    FWMIService := Unassigned;
    FSWbemLocator := Unassigned;
end;

相关阅读 >>

Delphi判断程序是否无响应

Delphi中的free和nil

Delphi中禁止webbrowser右键的方法

Delphi 详解 enumwindows 与 enumwindowsproc

Delphi 显示windows断开网络驱动器对话框

Delphi通过进程id获取主窗句柄

Delphi 如何确定windows安装的语言

Delphi richedit memo1支持中文搜索、向上查找、区分大小写

Delphi incyear、incmonth、incweek、incday、inchour、incminute、incsecond、incmillisecond �c 增时

Delphi xe5的新功能“ tlistview内置搜索过滤”

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...