Title: RE: [msvc] Automation, IDispatch, Class Explosing The Interface

Easy. Obtain the interface containing the 'get__This' function via
QueryInterface, etc. then call that method directly like so: (Note that
'propget' prepends "get_" -- there are 2 underscores, not one)

class MyRealObject* pRealObject;
hr = pInterface->get__This(reinterpret_cast<long*>(&pRealObject));

If you call this using a proxy, you'll get an error since it's a local-only
interface so both OCX's must be in the same apartment for this to work.
There are ways around that as well but it can become quite dangerous if
you're not *really* careful. Oh, also make absolutely sure you don't muck
with heap allocations from one to the other. I do so myself but there's
safeguards in place to make sure all of the DLL's share the same heap
allocator -- without which things go downhill real fast!

Ciao,
Dee

-----Original Message-----
From: BeginThread.com MSVC List [mailto:[EMAIL PROTECTED]]On Behalf
Of Jason Teagle
Sent: Thursday, September 11, 2003 11:51 AM
To: [EMAIL PROTECTED]
Subject: RE: [msvc] Automation, IDispatch, Class Explosing The Interface




> -----Original Message-----
> From: BeginThread.com MSVC List [mailto:[EMAIL PROTECTED]]On Behalf
> Of Dee Holtsclaw
> Sent: 11 September 2003 16:22
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: [msvc] Automation, IDispatch, Class Explosing The Interface
>
>
> Make sure you have a dual interface (or else a private COM-only interface
> you can QI for). One such method needs to be declared with hidden,
> restricted and local (preferably named with a leading _). The
> result of this
> is a long to keep it from being marshaled and this is then cast into your
> native class pointer. My root interface follows:
>
[CODE]
> Does this help?

Hmmm... the ins and outs of COM (and that's not some lame joke) are still
much of a mystery to me, so I'm afraid I don't follow your idea. How would I
use this from outside code, for example?

--
Jason Teagle
[EMAIL PROTECTED]

Reply via email to