Solved

VB.net :  FindWindowLike function to see if OUTlook is open

Posted on 2008-10-16
2
939 Views
Last Modified: 2012-05-05
I have this:
 OutlookHwnd = FindWindow(vbNullString, "Microsoft Outlook").  
 SetActiveWindow(OutlookHwnd)
            Putfocus(OutlookHwnd)
            SetForegroundWindow(OutlookHwnd)


Outlook's title changes depending on what is selected....
How can I use FindWindowLike to see if OUtlook is open then bring it to the front
0
Comment
Question by:TechMonster
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 22734227
Do it this way instead...

        Dim Outlook() As Process = Process.GetProcessesByName("Outlook")
        If Outlook.Length > 0 Then
            ' Just FYI, you can get the main window caption using "MainWindowTitle"...
            Debug.Print(Outlook(0).MainWindowTitle) ' <--- this is the current title

            ' ...but use "MainWindowHandle" to get the window handle
            SetActiveWindow(Outlook(0).MainWindowHandle)
            Putfocus(Outlook(0).MainWindowHandle)
            SetForegroundWindow(Outlook(0).MainWindowHandle)
        End If
0
 

Author Comment

by:TechMonster
ID: 22734723
That is far better than what I had before!  

Seems like an easier way than the Findwindowlike function,


Thanks a bunch!  You are truely a Genius!!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question