|
发表于 2024-4-29 18:37:26
|
显示全部楼层
福建省福州市
参考这个,
变量名 | 类 型 | 静态 | 数组 | 备 注 | objWbemLocator | 对象 | | | objWMIService | 对象 | | | colMonitoredProcesses | 对象 | | | objLatestProcess | 对象 | | | ObjectText | 文本型 | | | json | 类_json | | | CommandLine | 文本型 | | | ExecutablePath | 文本型 | | | ProcessId | 整数型 | | | ParentProcessId | 整数型 | | | Name | 文本型 | | | CoInitialize (0 ) objWbemLocator. 创建 (“WbemScripting.SWbemLocator”, )objWMIService = objWbemLocator. 对象型方法 (“ConnectServer”, “.”, “root\CIMV2”, , , , , , )colMonitoredProcesses = objWMIService. 对象型方法 (“ExecNotificationQuery”, “select * from __instancecreationevent within 1 where TargetInstance isa 'Win32_Process'”)判断循环首 (真)objLatestProcess = colMonitoredProcesses. 对象型方法 (“NextEvent”, )如果真 (objLatestProcess. 是否为空 () = 假)ObjectText = objLatestProcess. 文本方法 (“GetObjectText_”, ) ObjectText = 子文本替换 (ObjectText, 字符 (10 ), “”, , , 真)ObjectText = 子文本替换 (ObjectText, “;” + 字符 ( #Tab键 ), “,” + #引号, , , 真)ObjectText = “{” + 文本_取出中间文本 (ObjectText, “Process{”, “},”, , ) + “}”ObjectText = 子文本替换 (ObjectText, “ = ”, #引号 + “:”, , , 真)ObjectText = 子文本替换 (ObjectText, 字符 ( #Tab键 ), #引号, , , 真)ObjectText = 子文本替换 (ObjectText, “;”, “”, , , 真) 如果真 (json. 解析 (ObjectText, , )) CommandLine = json. 取通用属性 (“CommandLine”, ) ExecutablePath = json. 取通用属性 (“ExecutablePath”, ) ProcessId = 到整数 (json. 取通用属性 (“ProcessId”, )) ParentProcessId = 到整数 (json. 取通用属性 (“ParentProcessId”, )) Name = json. 取通用属性 (“Name”, ) 程序_Call (回调指针, lstrcpyn_文本型 (CommandLine, CommandLine, 0 ), lstrcpyn_文本型 (ExecutablePath, ExecutablePath, 0 ), ProcessId, ParentProcessId, lstrcpyn_文本型 (Name, Name, 0 )) 判断循环尾 ()CoUninitialize ()
|
|