Re: COM Basics
- From: "Brian Muth" <bmuth@xxxxxxxx>
- Date: Fri, 20 Oct 2006 14:37:47 -0700
<avesty@xxxxxxxxx> wrote in message
news:1161377945.996209.12300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I'm attempting to use the COM interface incorporated into PDFCreator
(http://www.pdfforge.org/node/407/964#comment-964). I'm an absolute
beginner when it comes to COM, so if someone could give me some
beginner tips that would be great.
So far I import the .exe with:
#import "C:\Program Files\PDFCreator\PDFCreator.exe"
In my code:
::CoInitialize(NULL);
CComPtr<__clsPDFCreator> pdfObject;
if (SUCCEEDED(pdfObject.CoCreateInstance(CLSID_clsPDFCreator)))
{
//try to do stuff with pdfObject
}
In the bit where I try to do stuff with pdfObject, none of the PDF
object methods are recognised. All give a 'is not a member of...'
error.
I don't have a header or anything, is that something I need to
generate? If so how? I have a number of examples for using COM with
pdfcreator, unfortunately none in C++ so i'm slightly lost.
The #import directive creates a *.tlh file in your Debug or Release folder.
Look there.
Add "raw_interfaces_only" as an attribute to the #import directive. This
will give you the interface names you are expecting. By default it defines
the names that are expected to be used by a smart pointer of the form
__clsPDFCreatorPtr, and pre-pends the original method names with "raw_".
This is what is confusing you. (Inspect the *.tlh file with and without the
"raw_interfaces_only" directive and you will see what I mean.)
Brian
.
- References:
- COM Basics
- From: avesty
- COM Basics
- Prev by Date: Re: Server Access via DCOM
- Next by Date: Re: Server Access via DCOM
- Previous by thread: COM Basics
- Next by thread: Re: COM Basics
- Index(es):
Relevant Pages
|