Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX

Status
Not open for further replies.

JRudisill

Programmer
Aug 4, 2003
54
US
How would I add a activex control at runtime to a form and be able to capture the events from the control. I know addobject will put the control on the form but I am not able to receive the events from the control when I do this. Do I use Define class and make the event a property? As well how would I handle two interfaces? Appreciate any answers someone may have.



DEFINE CLASS myclass AS session OLEPUBLIC

IMPLEMENTS _XEvents IN "ACTX.OCX"

PROCEDURE _XEvents_SendResult() AS VOID
* add user code here
ENDPROC

ENDDEFINE
 
Check EVENTHANDLER() function in help.
With your code:
Code:
oEvents = NEWOBJECT("myclass")
oConn   = NEWOBJECT([ActiveX.Object])
? EVENTHANDLER(oConn, oEvents)

DEFINE CLASS myclass AS session OLEPUBLIC

IMPLEMENTS _XEvents IN "ACTX.OCX"

PROCEDURE _XEvents_SendResult() AS VOID
* add user code here
ENDPROC

ENDDEFINE

Something like that, but not tested

Borislav Borissov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top