PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins Add CommandBarButton to Contacts form in C++

Reply

Add CommandBarButton to Contacts form in C++

 
Thread Tools Rate Thread
Old 09-07-2003, 05:59 PM   #1
Tobias Svensson
Guest
 
Posts: n/a
Default Add CommandBarButton to Contacts form in C++


Hello,
I am working on a Outlook client extension in VC++. I have a button added to
the standard toolbar in Outlook. Now I also would like to add the same
button when the user opens the Outlook form for contacts. (existing contact
or new contact)

How can I detect when a form containing contacts is opened and how do I add
the button?

Thanks...


  Reply With Quote
Old 09-07-2003, 09:09 PM   #2
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Add CommandBarButton to Contacts form in C++

You can do it in exactly same way, only context will be different
(EECONTEXT_VIEWER). Or you can use Outlook Object Model from your extension
(use IOutlookExtCallback) to add the buttons using OOM.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Tobias Svensson" <tobias@iptc.se> wrote in message
news:udeJBOjRDHA.2636@TK2MSFTNGP10.phx.gbl...
> Hello,
> I am working on a Outlook client extension in VC++. I have a button added

to
> the standard toolbar in Outlook. Now I also would like to add the same
> button when the user opens the Outlook form for contacts. (existing

contact
> or new contact)
>
> How can I detect when a form containing contacts is opened and how do I

add
> the button?
>
> Thanks...
>
>



  Reply With Quote
Old 11-07-2003, 09:55 AM   #3
Tobias Svensson
Guest
 
Posts: n/a
Default Re: Add CommandBarButton to Contacts form in C++

Thanks for the answer.
In IExchExt::Install I only seem to get messages for the email form
(EECONTEXT_READNOTEMESSAGE and EECONTEXT_SENDNOTEMESSAGE). I need the
contact form. Also, I don't succeed in adding the button to the newly opened
form, only to the Outlook application.
I installed it in registry with
4.0;D:\Projects\VC\TextExt\Debug\TestExt.dll;1;11111111111111;1111111
I am using Outlook 2000.

Here is some code I am using, if you can tell me if I am on the right
track... Code here is without any error checking and releasing of the
interfaces.

// Member pointer
Outlook::_ApplicationPtr m_pOApp;

// In IExchExt::Install get the Outlook pointer and save it like this:
IOutlookExtCallback* IOut = NULL;
IUnknown * punk = NULL;
IDispatch *IDisp = NULL;
pmecb->QueryInterface(IID_IOutlookExtCallback,(LPVOID*)&IOut);
IOut->GetObject(&punk);
hr = punk->QueryInterface(IID_IDispatch,(LPVOID*)&IDisp);
hr =
IDisp->QueryInterface(__uuidof(Outlook::_Application),(LPVOID*)&m_pOApp);
OApp = m_pOApp;

// Then in IExchExtCommands::InstallCommands I add the button like this.
Outlook::_ApplicationPtr pOApp = OApp;
Outlook::_ExplorerPtr pExp = pOApp->ActiveExplorer();
Office::_CommandBarsPtr pCmdBars = pExp->CommandBars;
Office::CommandBarPtr pMainBar = pCmdBars->ActiveMenuBar;
Office::CommandBarPtr pToolBar = pCmdBars->GetItem("Standard");
Office::_CommandBarButtonPtr pItem =
pToolBar->Controls->Add((long)Office::msoControlButton,vtMissing, vtMissing,
vtMissing, true);

What rows should be changed here to add the button to the new form instead?

Regards Tobias



"Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message
news:#O#2g2kRDHA.304@tk2msftngp13.phx.gbl...
> You can do it in exactly same way, only context will be different
> (EECONTEXT_VIEWER). Or you can use Outlook Object Model from your

extension
> (use IOutlookExtCallback) to add the buttons using OOM.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Tobias Svensson" <tobias@iptc.se> wrote in message
> news:udeJBOjRDHA.2636@TK2MSFTNGP10.phx.gbl...
> > Hello,
> > I am working on a Outlook client extension in VC++. I have a button

added
> to
> > the standard toolbar in Outlook. Now I also would like to add the same
> > button when the user opens the Outlook form for contacts. (existing

> contact
> > or new contact)
> >
> > How can I detect when a form containing contacts is opened and how do I

> add
> > the button?
> >
> > Thanks...
> >
> >

>
>



  Reply With Quote
Old 15-07-2003, 11:12 PM   #4
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Add CommandBarButton to Contacts form in C++

1. Your extension must be installed using an ECF file rather than registry
and have "MoreContexts" specified to receive IExchExt::Install() callbacks
for the messages other than IPM.Note
2. You need to track Application.Inspectors.NewInspector event. In the event
handler use the Inspctor object to access its Inspector.CommandBars
collection to add your toolbars/buttons.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Tobias Svensson" <tobias@iptc.se> wrote in message
news:OCoNTJ4RDHA.3236@TK2MSFTNGP10.phx.gbl...
> Thanks for the answer.
> In IExchExt::Install I only seem to get messages for the email form
> (EECONTEXT_READNOTEMESSAGE and EECONTEXT_SENDNOTEMESSAGE). I need the
> contact form. Also, I don't succeed in adding the button to the newly

opened
> form, only to the Outlook application.
> I installed it in registry with
> 4.0;D:\Projects\VC\TextExt\Debug\TestExt.dll;1;11111111111111;1111111
> I am using Outlook 2000.
>
> Here is some code I am using, if you can tell me if I am on the right
> track... Code here is without any error checking and releasing of the
> interfaces.
>
> // Member pointer
> Outlook::_ApplicationPtr m_pOApp;
>
> // In IExchExt::Install get the Outlook pointer and save it like this:
> IOutlookExtCallback* IOut = NULL;
> IUnknown * punk = NULL;
> IDispatch *IDisp = NULL;
> pmecb->QueryInterface(IID_IOutlookExtCallback,(LPVOID*)&IOut);
> IOut->GetObject(&punk);
> hr = punk->QueryInterface(IID_IDispatch,(LPVOID*)&IDisp);
> hr =
> IDisp->QueryInterface(__uuidof(Outlook::_Application),(LPVOID*)&m_pOApp);
> OApp = m_pOApp;
>
> // Then in IExchExtCommands::InstallCommands I add the button like this.
> Outlook::_ApplicationPtr pOApp = OApp;
> Outlook::_ExplorerPtr pExp = pOApp->ActiveExplorer();
> Office::_CommandBarsPtr pCmdBars = pExp->CommandBars;
> Office::CommandBarPtr pMainBar = pCmdBars->ActiveMenuBar;
> Office::CommandBarPtr pToolBar = pCmdBars->GetItem("Standard");
> Office::_CommandBarButtonPtr pItem =
> pToolBar->Controls->Add((long)Office::msoControlButton,vtMissing,

vtMissing,
> vtMissing, true);
>
> What rows should be changed here to add the button to the new form

instead?
>
> Regards Tobias
>
>
>
> "Dmitry Streblechenko" <dmitry@dimastr.com> wrote in message
> news:#O#2g2kRDHA.304@tk2msftngp13.phx.gbl...
> > You can do it in exactly same way, only context will be different
> > (EECONTEXT_VIEWER). Or you can use Outlook Object Model from your

> extension
> > (use IOutlookExtCallback) to add the buttons using OOM.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> >
> > "Tobias Svensson" <tobias@iptc.se> wrote in message
> > news:udeJBOjRDHA.2636@TK2MSFTNGP10.phx.gbl...
> > > Hello,
> > > I am working on a Outlook client extension in VC++. I have a button

> added
> > to
> > > the standard toolbar in Outlook. Now I also would like to add the same
> > > button when the user opens the Outlook form for contacts. (existing

> > contact
> > > or new contact)
> > >
> > > How can I detect when a form containing contacts is opened and how do

I
> > add
> > > the button?
> > >
> > > Thanks...
> > >
> > >

> >
> >

>
>



  Reply With Quote
Old 20-04-2007, 08:12 PM   #5
sunilmatta
Junior Member
 
Join Date: Apr 2007
Posts: 2
Trader Rating: (0)
Default please help me

Hi Tobias ,

I am facing the same problem
if u got the solution to this problem please email me.

Thanks,
Sunil Matta
sunil.matta@gmail.com

Quote:
Originally Posted by Tobias Svensson
Hello,
I am working on a Outlook client extension in VC++. I have a button added to
the standard toolbar in Outlook. Now I also would like to add the same
button when the user opens the Outlook form for contacts. (existing contact
or new contact)

How can I detect when a form containing contacts is opened and how do I add
the button?

Thanks...
sunilmatta is offline   Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off