How do I listen/identify when a program runs in Windows using C++? -
specifically, want listen when programs run , record information such as: timestamp, executable, windows name , user.
alternatively, use wmi interface find out what's running , take appropriate action. in vbscript code below wmi subsystem being queried select * win32_process
change process priority. find out other attributes available win32_process
, should find stuff that's heading in direction want go.
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 * win32_process name = '" & sprocess & "'") each oprocess in cprocesses oprocess.setpriority( npriority ) bdone = true next setpriority = bdone end function
Comments
Post a Comment