Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How do I minimize a window in VBScript with WMI

$
0
0

I found this script to open a program in a hidden window and it worked great.  I tried changing the constant from 0 to 2, 6, 7, and 11 to see if I could get it to run in a minimized window but none of the other settings worked.  The program opens but the window does not minimize.

Const MINIMIZE_WINDOW = 6

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set objStartup = objWMIService.Get("Win32_ProcessStartup")

Set objConfig = objStartup.SpawnInstance_

objConfig.ShowWindow = MINIMIZE_WINDOW

Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

strCommand = """C:\Program Files\Windows Media Player\wmplayer.exe"" /play http://listen.emfcdn.com/.../001_high.asx"

objProcess.Create strCommand, null, objConfig, intProcessID

Can you help?

Thanks!


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>