具体来说,我想听听程序何时运行并记录信息,例如:时间戳、可执行文件、窗口名称和用户。
最佳答案
或者,使用 WMI 界面找出正在运行的程序并采取适当的操作。在下面的 VBScript 代码中,正在使用 Select * from Win32_Process
查询 WMI 子系统,以更改进程优先级。找出 Win32_Process
可用的其他属性,您应该找到朝着您想要的方向前进的东西。
Const NORMAL_PRIORITY = 32
Const LOW_PRIORITY = 64
Const REALTIME_PRIORITY = 128
Const HIGH_PRIORITY = 256
Const BELOWNORMAL_PRIORITY = 16384
Const ABOVENORMAL_PRIORITY = 32768
Function SetPriority( sProcess, nPriority )
Dim sComputer
Dim oWMIService
Dim cProcesses
Dim oProcess
Dim bDone
bDone = False
sComputer = "."
Set oWMIService = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
Set cProcesses = oWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & sProcess & "'")
For Each oProcess in cProcesses
oProcess.SetPriority( nPriority )
bDone = True
Next
SetPriority = bDone
End Function
关于c++ - 当程序在 Windows 中使用 C++ 运行时,如何监听/识别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/186004/