Hi All, I am using this code to play a very short mp3, close it and re-run it. What I cannot figure out is how to run windows media player either hidden or minimized. I have tried several things with no luck. No matter what I try, the player window always appears. Thanks for any help!
Code:Sub Alert() Dim MyProcess As New Process Dim proc = Process.GetProcessesByName("WMPlayer") MyProcess.StartInfo.CreateNoWindow = True MyProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden MyProcess.StartInfo.FileName = "C:\alerts\audio_alert.mp3" MyProcess.Start() System.Threading.Thread.Sleep(5000) For Each runproc As Process In Process.GetProcessesByName("WMPlayer") runproc.Kill() Next End Sub




Reply With Quote
