know if there is an active inspector

  • Thread starter Thread starter Andrea Cacciarru
  • Start date Start date
A

Andrea Cacciarru

It's possible know if there is an active (displayed and focused) contact
item in outlook with outlook object model? I can handle new inspector event
but I want to know if there is one opened in certain moments.
Thank's in advance
Andrea
 
Hello Andrea,

Application.ActiveInspector will do the trick, but only if your Item is
activated.
If you show another form, your Inspector is deactivated.

--
regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


.... and IT works!
 
Have you looked at the Application.Inspectors collection and the
Application.ActiveInspector object?
 
Ok many thanks, now it works. Another little question on inspectors... when
I got an active Inspector it is possible to easily obtain an object (a combo
box) on a custom toolbar? I don't want to store every toolbar object in
memory, so when I got an active Inspector I would obtain a toolbar object in
the current inspector dinamically (a toolbar object is just a button or a
combo box) .

....
CComQIPtr <Office::_CommandBarComboBox> spCombo;
CComQIPtr <Outlook::_Inspector> spInspector;
CComPtr<Office::_CommandBars> spCmdBars;
CComPtr<Office::CommandBar> spCmdBar; <<-- the combo is previously added on
a local variable (spCmdBar)
string comboBoxText ="";
m_spApp->ActiveInspector(&spInspector);
if (!spInspector)
return comboBoxText; //return an empty string

spInspector->get_CommandBars(&spCmdBars);
spCmdBars->FindControl(???) or I should use pCmdBars->get_SOME method?

//... ????

//when I got the combo box object I should extract its selected text
BSTR bstrText;
spCombo->get_Text(&bstrText);
comboBoxText = bstrText; //convert BSTR to string


Andrea
 
Back
Top