Results 1 to 8 of 8

Thread: Check for Outlook running

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    St. Louis, MO USA
    Posts
    77
    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

  2. #2
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    St. Louis, MO USA
    Posts
    77
    Thanks, does the "rctrl_renwnd32" specify Outlook?

    Just curious how it will know to look for Outlook.

    Thanks,
    Doug

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    St. Louis, MO USA
    Posts
    77
    How do you know what value to look for? Is it a key in the registry?

    Thanks

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Spy++ utility. I know it comes with the Enterprise Edition, not positive about Professional, but I would guess so..

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    St. Louis, MO USA
    Posts
    77
    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!!!

  8. #8
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    No problem...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width