PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
Add CommandBarButton to Contacts form in C++
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
Add CommandBarButton to Contacts form in C++
![]() |
Add CommandBarButton to Contacts form in C++ |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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... |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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... > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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... > > > > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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... > > > > > > > > > > > > |
|
|
|
#5 | |
|
Junior Member
|
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:
|
|
|
|
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

