know if there is an active inspector

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
 
H

Helmut Obertanner

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!
 
S

Sue Mosher [MVP-Outlook]

Have you looked at the Application.Inspectors collection and the
Application.ActiveInspector object?
 
A

Andrea Cacciarru

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
 

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