[RESOLVED] [2008] Check if Outlook is already running
I am currently using the code below to open outlook automatically.
Code:
Dim psInfo As New System.Diagnostics.ProcessStartInfo("OUTLOOK.EXE")
psInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized
Dim myProcess As Process = System.Diagnostics.Process.Start(psInfo)
However, this simply opens a new instance regardless of whether it is already open or not.
I'd like to check if there is an existing instance, and if so don't open outlook.
How can I do this please ?
Re: [2008] Check if Outlook is already running
Code:
Dim procs() As Process = Process.GetProcessesByName("Outlook")
If procs.Count > 0 Then MsgBox("Oulook is running")
' Obviously, each element in the procs() array will contain an outlook process
Re: [2008] Check if Outlook is already running
Thanks cicatrix I'll give this a go