0

i have realized for my outlook addin a messagebox custom. Now, when this messagebox is shown, it's unlinked with the main window of Outlook. How can "attach" my window with the outlook window as a normal messagebox? Is there a property to link to windows?

-- EDIT ---

The problem is simply this:

  1. Open Outlook
  2. Show a custom messagebox in outlook
  3. Change focus ( i open a new window such as chrome browser
  4. Return to Outlook: now my messagebox is not "link" to Outlook. I want that my messagebox is displayed always when outlook window is open
3
  • You need to lay out the problem much more precisely.
    – meilke
    Sep 27, 2013 at 9:08
  • Thanks for answer.The problem is simply this: 1-open Outlook 2-show a custom messagebox in outlook 3-change focus ( i open a new window such as chrome browser 4-return to Outlook: now my messagebox is not "link" to Outlook. I want that my messagebox is displayed always when outlook window is open Sep 27, 2013 at 9:45
  • I do not know the answer but it might be helpful to put these important details in the question.
    – meilke
    Sep 27, 2013 at 9:51

2 Answers 2

0

Finally i solved. in the code of my messagebox i've inserted the code below:

IntPtr hWnd = Process.GetProcessById(Process.GetCurrentProcess().Id).MainWindowHandle; System.Windows.Interop.WindowInteropHelper wih = new System.Windows.Interop.WindowInteropHelper(this);

wih.Owner = hWnd;

as illustred here

Like this, any type of message (messagebox, generic hanlded error of your application) is "hooked" to the main application. The application is calculated by Process.GetCurrentProcess().Id.

Hope that this help someone in the future.

0

The more rigorous way to retrieve the Outlook's HWND would be to cast Application.ActiveWindow (can be either Explorer or Inspector) to IOleWindow and call IOleWindow.GetWindow().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.