I'm writing an OCX or two in VC (6, not .NET).
I'm primarily using the OCXs as controls in a VB application. Used
individually, no problems whatsoever (I might even venture to say I'm
getting proficient at creating OCXs!).
I want one OCX to be able to use the other (act as a layer on top). I want
the VB app to be able to tell one control about the other, so that
internally the first control can call the second's methods natively, if
possible.
I can pass "the control" into a method in the other by wrapping it in a
variant. What comes through in the VC code is a VARIANT of type VT_DISPATCH.
Thus, I can get an IDispatch out of it easily.
Now comes the crunch: I'd like, ideally, to be able to get hold of the
instance of the class that exposes that interface, my control class, so that
I can call its methods directly. But so far, all I can find is that I can
try and call those functions using IDispatch::Invoke() or use things like
CreateStdDispatch() and DispatchInvoke() (all of which I barely understand).
Is there any way I can use something like a CoGetXXX() call or something to
get access to the COleControl object (on which the OCX is based) from that
IDispatch?
If not, what would people recommend would be the best way to get OCX 1 to
use that IDispatch from OCX 2 to call OCX 2 methods?
Any help or pointers (groan) would be appreciated.
--
Jason Teagle
[EMAIL PROTECTED]
