Getting the Outlook main window

Z

z0nd0r

Hi at all,

i'm developing an Add-In for outlook and want to use the method
System.Windows.MessageBox.Show(Window owner, ...) in the method
public void OnStartupComplete(ref System.Array custom)
{
...
}
of my Add-In.

The owner window of the MessageBox should be the main outlook window itself.
How can i get it?

I searched for that problem and found some threads about it, but i can't
extract a soloution for me.


Regards
z0nd0r
 
K

Ken Slovak - [MVP - Outlook]

I usually use a class that I call OutlookWindow.

I set that up to inherit IWin32Window, and expose an IntPtr as a read-only
Handle property. The handle I get using a PInvoke of FindWindow(), using the
ActiveExplorer() or Explorers[1] caption and window class to get the hWnd of
the window. The class name for an Explorer window is "rctrl_renwnd32".

I then pass that OutlookWindow class to whatever windows I want as children
of that Exporer window.
 
D

Dmitry Streblechenko

Or cast the Outloook.Explorer object to IOleWindow and call
IOleWindow::GetWindow().

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Ken Slovak - said:
I usually use a class that I call OutlookWindow.

I set that up to inherit IWin32Window, and expose an IntPtr as a read-only
Handle property. The handle I get using a PInvoke of FindWindow(), using
the ActiveExplorer() or Explorers[1] caption and window class to get the
hWnd of the window. The class name for an Explorer window is
"rctrl_renwnd32".

I then pass that OutlookWindow class to whatever windows I want as
children of that Exporer window.




z0nd0r said:
Hi at all,

i'm developing an Add-In for outlook and want to use the method
System.Windows.MessageBox.Show(Window owner, ...) in the method
public void OnStartupComplete(ref System.Array custom)
{
...
}
of my Add-In.

The owner window of the MessageBox should be the main outlook window
itself.
How can i get it?

I searched for that problem and found some threads about it, but i can't
extract a soloution for me.


Regards
z0nd0r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top