how to get height of inspector window

S

sujit

I need to know the height and width of the Inspector window, but when I access it using

void myinsp_NewInspector(Microsoft.Office.Interop.Outlook.Inspect or Inspector)
{
int ht;
ht = Inspector.Height // Error is thrown here
}

It throws an error
'Inspector.Height' threw an exception of type 'System.Runtime.InteropServices.COMException'

What wrong I am doing ?
 
K

Ken Slovak - [MVP - Outlook]

When the NewInspector() event fires the Inspector object is a weak object
reference and not all properties are valid. Since the Inspector hasn't been
actually displayed at that time Inspector.Height or Inspector.Width aren't
valid properties then.

Wait for the initial Inspector.Activate() event to fire to get the Inspector
window dimensions. Subscribe to the Inspector.Activate() event in
NewInspector() and wait for it to fire.
 
Top