• Welcome to Theos PowerBasic Museum 2017.

Multiple COM instances - how to tell them apart?

Started by Paul Squires, March 24, 2009, 01:31:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paul Squires

Hi,

I am working on COM/ActiveX integration using José's new includes and OLE Container. I am also using José's TypeLib Browser instead of PB's COM Browser.

For objects that have Events, what is the best way to determine which control has fired the event? Say, that I have 2 masked edit controls on the dialog, I point both controls to the same events code.

(summary of the code):

hMaskedEd and hMaskedEd2 are window handles

pMaskedEd = OC_GetDispatch(hMaskedEd)
pMaskedEvents = CLASS "CMaskEdBoxEvents"
EVENTS FROM pMaskedEd CALL pMaskedEvents
pMaskedEd = NOTHING

pMaskedEd = OC_GetDispatch(hMaskedEd2)
EVENTS FROM pMaskedEd CALL pMaskedEvents
pMaskedEd = NOTHING


How can I put code in the "Change" event for the control that determines which masked edit control has fired the Change event?


INTERFACE MaskEdBoxEventsImpl GUID$("{C932BA87-4374-101B-A56C-00AA003668DC}") AS EVENT

  INHERIT IDispatch

   ' =====================================================================================
   METHOD Change <1>

     ' *** Insert your code here ***
     OutputDebugString FUNCNAME$
     
   END METHOD



Sorry if this sounds like an easy question - maybe I am missing something really simple?  :)


Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com

José Roca

 
The only way would be to have a separate event class for each instance of the control.

Paul Squires

Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com