PC Review


Reply
Thread Tools Rate Thread

Add CommandBarButton to Contacts form in C++

 
 
Tobias Svensson
Guest
Posts: n/a
 
      9th Jul 2003
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
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      9th Jul 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
 
Tobias Svensson
Guest
Posts: n/a
 
      11th Jul 2003
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" <(E-Mail Removed)> wrote in message
news:#O#(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      15th Jul 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:#O#(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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
 
New Member
Join Date: Apr 2007
Posts: 2
 
      20th Apr 2007
Hi Tobias ,

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

Thanks,
Sunil Matta
(E-Mail Removed)

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...
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Could i do this on a CommandBarButton? Ken Slovak - [MVP - Outlook] Microsoft Outlook Program Addins 0 14th Jul 2009 03:10 PM
New form freezes on CommandBarButton.Click tobias_ebsen@hotmail.com Microsoft Outlook Program Addins 1 9th Oct 2006 03:04 AM
Can't set CommandBarButton Tag property? 280Z28 Microsoft Outlook Interoperability 1 14th Jun 2006 07:59 PM
CommandBarButton Stas Microsoft Access 0 31st Oct 2005 10:57 AM
Launching form from commandbarbutton Nicolai Grødum Microsoft Outlook Program Addins 3 22nd Dec 2003 03:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:48 PM.