Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Help with activex-in-a-box (Read 2190 times)
Leandro Guzmán
Guest


Help with activex-in-a-box
Feb 1st, 2006 at 4:15pm
Print Post  
Hi there  Roll Eyes, I'm using ver. 2.4.
I'm using an activex inside a box, and I have no problem to comunicate with them using:

Code
Select All
IUnknown* punk = Box1.GetAxRawPtr();
LGSpread::_UserControl1Ptr spread(punk);
spread->XXXXX;



punk->Release(); 



But I don't know how to recive an event generated by the control.
do you have any example!??

thanks Wink

by the way, my activex was developed in VB6.0


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Help with activex-in-a-box
Reply #1 - Feb 1st, 2006 at 4:48pm
Print Post  
Hi,

You are in a big trouble  Tongue

First implement the outgoing events interface in some of your classes or in a new class. Say if the event interface contains two events, Click(x, y) and KeyDown(char), inherit the class from the interface and implement the two methods.

Query the hosted control for its IConnectionPointContainer interface, call the pointer 'cpc'.

Call cpc->FindConnectionPoint(IID_YourEventInterface, &cp) to get a pointer to IConnectionPoint interface, say we call it 'cp'.

Call cp->Advise, passing a pointer to the object which implements all event methods. Save your cookie.

Now the hosted control will call your methods when event occur.

When you finish using the hosted control, call cp->Unadvise(the saved cookie).

Call Release on some of the pointers above to avoid memory leaks.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint