Solved

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

Posted on 2008-10-16
2
913 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Visual Studio 2013 Publish 13 46
how to add field in my script 2 24
Need help with a query. 10 44
Format column on datatable 7 17
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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now