Re: API troulble
- From: Scot T Brennecke <ScotBspamhater@xxxxxxxx>
- Date: Wed, 29 Jun 2005 05:10:12 -0500
Based on your reply, I'm not sure you really want all that hassle. Yes,
you could use CLSIDFromProgID and create your objects from Automation
clients. But if you just want to have multiple document types, the
standard MFC document/view architecture provides all the means necessary
to select File | New from the menu, choose a document type, and let the
MFC framework create your document, view, and frame window.
If you just want data classes to be embedded within your normal
document, you don't want to derive them from CDocument at all, probably.
Just derive them from CObject, maybe, or perhaps have no base class.
In article <42c26baa$0$4166$9a6e19ea@xxxxxxxxxxxxxxxxxxxxxxxxx>,
ContactGT_remove_@xxxxxxxxxxx says...
> Thanks for the tip - I'll look into those methods on MSDN.
>
> It wasn't my choice not to just use normal constructors. I created the
> classes through the class wizard and ticked 'automation' and it made the
> constructors protected and didn't add a method allowing me to instantiate
> objects! I presumed there was a reason for this, so didn't like to move
> things around!
>
> My test application just sees the interfaces, so there needs to be a method
> to get/create new instances of the classes. As with linking to Excel, the
> application is instantiated, then you ask for the group of workbooks, from
> that group of workbooks, there is a method to create a new workbook. I need
> something along these lines (I think), I just don't know how to create
> objects!
>
>
>
> "Scot T Brennecke" <ScotBspamhater@xxxxxxxx> wrote in message
> news:MPG.1d2c0cda17edcc2c989c4d@xxxxxxxxxxxxxxxxxxxxxxx
> > Do I understand correctly that you want to create COM interfaces for
> > your classes, rather than just calling C++ constructors and class
> > methods directly? If so, you will want to use something like
> > CoCreateInstance to instantiate your COM objects, then QueryInterface
> > for these new interfaces.
> >
> > In article <42c12483$0$26767$9a6e19ea@xxxxxxxxxxxxxxxxxxxxxxxxx>,
> > ContactGT_remove_@xxxxxxxxxxx says...
> >> Writing an API for my application and I have a problem. I have an
> >> interface
> >> class for my normal document, but I want to create a few new interfaces
> >> IDoc
> >> IPerson ITeam etc...
> >>
> >> I create a new class "CTeam" choose CDocument for its base class and
> >> choose
> >> 'automation' and hey presto I get a new ITeam interface. How do I then
> >> create an instance of CTeam because its constructor is protected and it
> >> uses
> >> DECLARE_DYNCREATE, which is also protected.
> >>
> >> In my mini-app I have written to test the API on my main app, I cannot
> >> create an instance of ITeam because I just get NULL references!
> >>
> >> Basically, how do I use my new class???
.
- Follow-Ups:
- Re: API troulble
- From: GT
- Re: API troulble
- References:
- API troulble
- From: GT
- Re: API troulble
- From: Scot T Brennecke
- Re: API troulble
- From: GT
- API troulble
- Prev by Date: CFile (looking for directory)
- Next by Date: Re: CFile (looking for directory)
- Previous by thread: Re: API troulble
- Next by thread: Re: API troulble
- Index(es):
Relevant Pages
|