Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8651183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:59:59+00:00 2026-06-12T13:59:59+00:00

I have an outlook plugin which pops up a WPF window Is there a

  • 0

I have an outlook plugin which pops up a WPF window

Is there a way to set the WPF’s Window.Owner property to Outlook?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:00:01+00:00Added an answer on June 12, 2026 at 2:00 pm

    Kudos to @reedcopsey for putting us on the right track…

    The trick for retrieving the Outlook Handle is using reflection to obtain the active window’s title (Caption) and the FindWindow Win32 API to obtain the active window IntPtr handle (inspector, explorer, etc.). Inspired from this MSDN forum post. Once you have the active window handle, you can leverage WindowInteropHelper for managing the owner relationship.

    Retrieving Outlook Handle (via ActiveWindow)

    Window yourWPFWindow = new Window();
    dynamic activeWindow = Globals.ThisAddIn.Application.ActiveWindow();
    IntPtr outlookHwnd = new OfficeWin32Window(activeWindow).Handle;
    WindowInteropHelper wih = new WindowInteropHelper(yourWPFWindow);
    wih.Owner = outlookHwnd;
    yourWPFWindow.Show();
    

    OfficeWin32Window (Helper Class)

    ///<summary>
    /// This class retrieves the IWin32Window from the current active Office window.
    /// This could be used to set the parent for Windows Forms and MessageBoxes.
    ///</summary>
    ///<example>
    /// OfficeWin32Window parentWindow = new OfficeWin32Window (ThisAddIn.OutlookApplication.ActiveWindow ());   
    /// MessageBox.Show (parentWindow, "This MessageBox doesn't go behind Outlook !!!", "Attention !", MessageBoxButtons.Ok , MessageBoxIcon.Question );
    ///</example>
    public class OfficeWin32Window : IWin32Window
    {
    
        ///<summary>
        /// The <b>FindWindow</b> method finds a window by it's classname and caption.
        ///</summary>
        ///<param name="lpClassName">The classname of the window (use Spy++)</param>
        ///<param name="lpWindowName">The Caption of the window.</param>
        ///<returns>Returns a valid window handle or 0.</returns>
        [DllImport("user32")]
        public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
    
        #region IWin32Window Members
    
        ///<summary>
        /// This holds the window handle for the found Window.
        ///</summary>
        IntPtr _windowHandle = IntPtr.Zero;
    
        ///<summary>
        /// The <b>Handle</b> of the Outlook WindowObject.
        ///</summary>
        public IntPtr Handle
        {
            get { return _windowHandle; }
        }
    
        #endregion
    
        ///<summary>
        /// The <b>OfficeWin32Window</b> class could be used to get the parent IWin32Window for Windows.Forms and MessageBoxes.
        ///</summary>
        ///<param name="windowObject">The current WindowObject.</param>
        public OfficeWin32Window(object windowObject)
        {
            string caption = windowObject.GetType().InvokeMember("Caption", System.Reflection.BindingFlags.GetProperty, null, windowObject, null).ToString();
    
            // try to get the HWND ptr from the windowObject / could be an Inspector window or an explorer window
            _windowHandle = FindWindow("rctrl_renwnd32\0", caption);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to have an outlook add-in automatically close and reload at
Using VB6, I have created an Outlook plugin, that has a property page. The
I have a MS Outlook 2010 plugin that forwards emails to a pre-set email
We have a project for an Outlook plugin .vsto that we're trying to sign
I have an outlook add-in which runs only on the first startup of Outlook,
I have the following C# code to launch an outlook window. The one think
I have an Outlook Addin which does some processing of the Outlook mailboxes. On
I have an Outlook plugin that I am deploying using ClickOne (right click on
I'm trying to do the following: We have an outlook plugin, written in .NET
I'm coding an Outlook 2010 plug-in in .NET 4.0, which use WPF technology, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.