How can I check to see if Outlook is running? If it isn't, can I just call a shell command to open it?
Thx
Doug
Printable View
How can I check to see if Outlook is running? If it isn't, can I just call a shell command to open it?
Thx
Doug
Here ya go:
Code:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim rc As Long, blnRunning As Boolean
rc = FindWindow("rctrl_renwnd32", vbNullString)
blnRunning = IIf(rc, True, False)
If blnRunning Then MsgBox "Running"
End Sub
Thanks, does the "rctrl_renwnd32" specify Outlook?
Just curious how it will know to look for Outlook.
Thanks,
Doug
All that does is specify Outlooks class name. If the return value is zero, then the window could not be found, thus not running. Good piece of code he came up with!
How do you know what value to look for? Is it a key in the registry?
Thanks
Spy++ utility. I know it comes with the Enterprise Edition, not positive about Professional, but I would guess so..
Awesome. Yes it does come with Pro and there are at least some entries in the VS 6.0 help file on it as well.
Thanks!!!
No problem...:D