Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

943 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

6 Experts available now in Live!

Get 1:1 Help Now