2009. 11. 20. 00:22
[WMI] run an application in a hidden window?
2009. 11. 20. 00:22 in 3. Implementation/VB / Java Script
Const HIDDEN_WINDOW = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject( _
"winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create( _
"Notepad.exe", null, objConfig, intProcessID)
From MSDn (ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.WIN32COM.v10.en/wmisdk/wmi/wmi_tasks__processes.htm)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject( _
"winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create( _
"Notepad.exe", null, objConfig, intProcessID)
From MSDn (ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.WIN32COM.v10.en/wmisdk/wmi/wmi_tasks__processes.htm)