ActiveX event return

Started by Anonymous, March 08, 2006, 12:23:15 AM

Previous topic - Next topic

Anonymous

FireFly generated an event inc  file for me on an activex object "IServer which  include a section like this:

--------- start of section---------------------------------------

FUNCTION IServerEvents1_ResponseDone(BYVAL dwCookie AS DWORD, BYREF pdispparams AS DISPPARAMS) AS DWORD
  LOCAL pv AS VARIANT PTR, pvapi AS VARIANTAPITYPE PTR
  pv = pdispparams.VariantArgs : pvapi = pv
'  ==============================================================================
'  Parameters in DISPPARAMS are zero based and in reverse order
'  ==============================================================================
  STATIC prmUser AS LONG
  prmUser = VARIANT#(@pv[0])
  ' To return a value, use:
  ' prmUser = <value> : @pvapi[0].vd.@plVal = prmUser
'  ==============================================================================
'  *** Put your code here ***
'  ==============================================================================
  FUNCTION = 0  ' %S_OK
END FUNCTION

------------------- end of section --------------------

It traps the event correctly, which correpond to event in VB:
 
"Sub IServer_RequestDone(User)"

The "User" there is an object type which in my program corresponds to an interface declared as :

"INTERFACE DISPATCH IServerUser"

For me to read properties of this dispatch/object, I would need  to link the prmUser (long variable)  as captured in the event to this disptach type. I don't really know how this can be done and will appreciate any kind assistance.

Regards.

Kunhock

Anonymous

Ha .. found how to do it !

I need to change the generated code so that the parameter from dispatch could be recieved as variant.  Then set dispatch instance using it.

Regards.

Kunhock