PC Review


Reply
Thread Tools Rate Thread

Query Interface on a C++ addin

 
 
James Callahan
Guest
Posts: n/a
 
      11th Jun 2004
I have built a C++ COM Addin for Outlook. All of the
reference material says I can access the Outllok Object
Model for Contacts as follows:

_ApplicationPtr pApp;
_ItemsPtr pItems;
MAPIFolderPtr pFolder;
_ContactItemPtr pContact;
hr=pApp.CreateInstance(__uuidof(Application));
pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
->GetDefaultFolder(olFolderContacts);
pItems = pFolder->GetItems();
pContact = pItems->GetFirst();


Unfortunately, I get an error when I try to compile which
states that the GetNamespace does not take one parameter.
How can get to the interfaces in the mso.dll? I am using
the following import command:

#import "C\<my location>\mso.dll"
rename_namespace("Office"),named_guids
using namespace Office;
#import "C:\<my location>\MSOUTL.OLB"
rename_namespace("Outlook"), raw_interfaces_only,
named_guids
using namespace Outlook;

Thanks in advance,
James
 
Reply With Quote
 
 
 
 
Michael Tissington
Guest
Posts: n/a
 
      11th Jun 2004
Here is the list of imports that I use ...

#import "D:\My Documents\SQLView\Outlook\mso.dll"
#import "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\vbe6ext.olb"
#import "D:\My Documents\SQLView\Outlook\msoutl.olb"
rename_namespace("Outlook")
#import "C:\Windows\System32\stdole2.tlb" rename_namespace("Forms")
#import "C:\Windows\System32\fm20.dll" exclude("OLE_COLOR", "OLE_HANDLE",
"Font") rename_namespace("Forms")


--
Michael Tissington
http://www.oaklodge.com
http://www.tabtag.com


"James Callahan" <(E-Mail Removed)> wrote in message
news:1aff901c44f51$21273760$(E-Mail Removed)...
> I have built a C++ COM Addin for Outlook. All of the
> reference material says I can access the Outllok Object
> Model for Contacts as follows:
>
> _ApplicationPtr pApp;
> _ItemsPtr pItems;
> MAPIFolderPtr pFolder;
> _ContactItemPtr pContact;
> hr=pApp.CreateInstance(__uuidof(Application));
> pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
> ->GetDefaultFolder(olFolderContacts);
> pItems = pFolder->GetItems();
> pContact = pItems->GetFirst();
>
>
> Unfortunately, I get an error when I try to compile which
> states that the GetNamespace does not take one parameter.
> How can get to the interfaces in the mso.dll? I am using
> the following import command:
>
> #import "C\<my location>\mso.dll"
> rename_namespace("Office"),named_guids
> using namespace Office;
> #import "C:\<my location>\MSOUTL.OLB"
> rename_namespace("Outlook"), raw_interfaces_only,
> named_guids
> using namespace Outlook;
>
> Thanks in advance,
> James



 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      14th Jun 2004
Thanks for the list of imports but I am having some
diffculty with the "raw_interfaces_only" part. By
including that in the import statement, what am I
excluding?
Thanks
James
>-----Original Message-----
>Here is the list of imports that I use ...
>
>#import "D:\My Documents\SQLView\Outlook\mso.dll"
>#import "C:\Program Files\Common Files\Microsoft
>Shared\VBA\VBA6\vbe6ext.olb"
>#import "D:\My Documents\SQLView\Outlook\msoutl.olb"
>rename_namespace("Outlook")
>#import "C:\Windows\System32\stdole2.tlb" rename_namespace

("Forms")
>#import "C:\Windows\System32\fm20.dll" exclude

("OLE_COLOR", "OLE_HANDLE",
>"Font") rename_namespace("Forms")
>
>
>--
>Michael Tissington
>http://www.oaklodge.com
>http://www.tabtag.com
>
>
>"James Callahan" <(E-Mail Removed)> wrote in

message
>news:1aff901c44f51$21273760$(E-Mail Removed)...
>> I have built a C++ COM Addin for Outlook. All of the
>> reference material says I can access the Outllok Object
>> Model for Contacts as follows:
>>
>> _ApplicationPtr pApp;
>> _ItemsPtr pItems;
>> MAPIFolderPtr pFolder;
>> _ContactItemPtr pContact;
>> hr=pApp.CreateInstance(__uuidof(Application));
>> pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
>> ->GetDefaultFolder(olFolderContacts);
>> pItems = pFolder->GetItems();
>> pContact = pItems->GetFirst();
>>
>>
>> Unfortunately, I get an error when I try to compile

which
>> states that the GetNamespace does not take one

parameter.
>> How can get to the interfaces in the mso.dll? I am

using
>> the following import command:
>>
>> #import "C\<my location>\mso.dll"
>> rename_namespace("Office"),named_guids
>> using namespace Office;
>> #import "C:\<my location>\MSOUTL.OLB"
>> rename_namespace("Outlook"), raw_interfaces_only,
>> named_guids
>> using namespace Outlook;
>>
>> Thanks in advance,
>> James

>
>
>.
>

 
Reply With Quote
 
Michael Tissington
Guest
Posts: n/a
 
      14th Jun 2004
You should not use raw_interfaces_only.

Why don't you take a look at the generated header files to see the
difference.

--
Michael Tissington
http://www.oaklodge.com
http://www.tabtag.com


<(E-Mail Removed)> wrote in message
news:1c5a301c45252$49dc3260$(E-Mail Removed)...
> Thanks for the list of imports but I am having some
> diffculty with the "raw_interfaces_only" part. By
> including that in the import statement, what am I
> excluding?
> Thanks
> James
> >-----Original Message-----
> >Here is the list of imports that I use ...
> >
> >#import "D:\My Documents\SQLView\Outlook\mso.dll"
> >#import "C:\Program Files\Common Files\Microsoft
> >Shared\VBA\VBA6\vbe6ext.olb"
> >#import "D:\My Documents\SQLView\Outlook\msoutl.olb"
> >rename_namespace("Outlook")
> >#import "C:\Windows\System32\stdole2.tlb" rename_namespace

> ("Forms")
> >#import "C:\Windows\System32\fm20.dll" exclude

> ("OLE_COLOR", "OLE_HANDLE",
> >"Font") rename_namespace("Forms")
> >
> >
> >--
> >Michael Tissington
> >http://www.oaklodge.com
> >http://www.tabtag.com
> >
> >
> >"James Callahan" <(E-Mail Removed)> wrote in

> message
> >news:1aff901c44f51$21273760$(E-Mail Removed)...
> >> I have built a C++ COM Addin for Outlook. All of the
> >> reference material says I can access the Outllok Object
> >> Model for Contacts as follows:
> >>
> >> _ApplicationPtr pApp;
> >> _ItemsPtr pItems;
> >> MAPIFolderPtr pFolder;
> >> _ContactItemPtr pContact;
> >> hr=pApp.CreateInstance(__uuidof(Application));
> >> pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
> >> ->GetDefaultFolder(olFolderContacts);
> >> pItems = pFolder->GetItems();
> >> pContact = pItems->GetFirst();
> >>
> >>
> >> Unfortunately, I get an error when I try to compile

> which
> >> states that the GetNamespace does not take one

> parameter.
> >> How can get to the interfaces in the mso.dll? I am

> using
> >> the following import command:
> >>
> >> #import "C\<my location>\mso.dll"
> >> rename_namespace("Office"),named_guids
> >> using namespace Office;
> >> #import "C:\<my location>\MSOUTL.OLB"
> >> rename_namespace("Outlook"), raw_interfaces_only,
> >> named_guids
> >> using namespace Outlook;
> >>
> >> Thanks in advance,
> >> James

> >
> >
> >.
> >



 
Reply With Quote
 
James Callahan
Guest
Posts: n/a
 
      20th Jun 2004
Thanks...I printed the entire header file as well as the generated library
and see the difference. Only problem now is that if I remove the
"raw_intefaces_only" part, I generate a host of new errors in boilerplate
code from Amit Day's article on ALT/COM addins for Outlook. If I understand
correctly, we can access Office/Outlook type libraries by 1) using the
#import command, 2) including the generated midl files directly and 3) via
MFC COM. I have examples of two of the three and will experiment around to
see which works best. As it stands now, I am using the #import with the
raw_interfaces and have managed to access the functions I wanted although
not in the manner I expected. Is the "raw_intefaces_only" the reason that I
am forced to code
CComPtr <Outlook::_Namespace> bNamespace;
HRESULT hr = pApp->GetNamespace(_b_str_t("MAPI"), &bNamespace);
instead of
bNamespace = pApp->GetNamespace(_bstr_t("MAPI"));

I really appreaciate your taking the time with me. I am trying to expand my
horizons and learn this ALT/COM code.
James
"Michael Tissington" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> You should not use raw_interfaces_only.
>
> Why don't you take a look at the generated header files to see the
> difference.
>
> --
> Michael Tissington
> http://www.oaklodge.com
> http://www.tabtag.com
>
>
> <(E-Mail Removed)> wrote in message
> news:1c5a301c45252$49dc3260$(E-Mail Removed)...
> > Thanks for the list of imports but I am having some
> > diffculty with the "raw_interfaces_only" part. By
> > including that in the import statement, what am I
> > excluding?
> > Thanks
> > James
> > >-----Original Message-----
> > >Here is the list of imports that I use ...
> > >
> > >#import "D:\My Documents\SQLView\Outlook\mso.dll"
> > >#import "C:\Program Files\Common Files\Microsoft
> > >Shared\VBA\VBA6\vbe6ext.olb"
> > >#import "D:\My Documents\SQLView\Outlook\msoutl.olb"
> > >rename_namespace("Outlook")
> > >#import "C:\Windows\System32\stdole2.tlb" rename_namespace

> > ("Forms")
> > >#import "C:\Windows\System32\fm20.dll" exclude

> > ("OLE_COLOR", "OLE_HANDLE",
> > >"Font") rename_namespace("Forms")
> > >
> > >
> > >--
> > >Michael Tissington
> > >http://www.oaklodge.com
> > >http://www.tabtag.com
> > >
> > >
> > >"James Callahan" <(E-Mail Removed)> wrote in

> > message
> > >news:1aff901c44f51$21273760$(E-Mail Removed)...
> > >> I have built a C++ COM Addin for Outlook. All of the
> > >> reference material says I can access the Outllok Object
> > >> Model for Contacts as follows:
> > >>
> > >> _ApplicationPtr pApp;
> > >> _ItemsPtr pItems;
> > >> MAPIFolderPtr pFolder;
> > >> _ContactItemPtr pContact;
> > >> hr=pApp.CreateInstance(__uuidof(Application));
> > >> pFolder = pApp->GetNamespace(_bstr_t("MAPI"))
> > >> ->GetDefaultFolder(olFolderContacts);
> > >> pItems = pFolder->GetItems();
> > >> pContact = pItems->GetFirst();
> > >>
> > >>
> > >> Unfortunately, I get an error when I try to compile

> > which
> > >> states that the GetNamespace does not take one

> > parameter.
> > >> How can get to the interfaces in the mso.dll? I am

> > using
> > >> the following import command:
> > >>
> > >> #import "C\<my location>\mso.dll"
> > >> rename_namespace("Office"),named_guids
> > >> using namespace Office;
> > >> #import "C:\<my location>\MSOUTL.OLB"
> > >> rename_namespace("Outlook"), raw_interfaces_only,
> > >> named_guids
> > >> using namespace Outlook;
> > >>
> > >> Thanks in advance,
> > >> James
> > >
> > >
> > >.
> > >

>
>



 
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
Can't get rid of a specific Excel addin in MSIE - I managed to get rid of it in Excel but not in the excel addin for ie WMB Windows XP Internet Explorer 0 20th Apr 2005 06:43 PM
VTiger CRM Outlook Addin Interferes with Outlook COM Addin Functionality TC Microsoft Outlook Installation 0 9th Dec 2004 06:01 AM
Removing an addin from the addin's list dialog Jim Bassett Microsoft Excel Programming 0 12th Jan 2004 04:11 PM
Remove Excel AddIn from AddIn List !! Help carl Microsoft Excel Programming 2 8th Dec 2003 04:36 PM
howtofix excel 2000 says invalid AddIn for valid excel97 AddIn robm Microsoft Excel Discussion 0 24th Sep 2003 06:06 PM


Features
 

Advertising
 

Newsgroups
 


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