Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot get eventhandler() to work
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00839068
Message ID:
00839353
Views:
15
You would have to create an event interface using something like C/C++ or Delphi. VFP can not be used to create COM components that export events. It can only be used to bind to events already exported.

HTH.

>Hi all,
>
>What are the reasons this code would fail to work ?
>
>LOCAL x as myclass
>LOCAL oMsg as msg.msgServer2
>
>x=NEWOBJECT("myclass")
>
>oMsg = crea("msg.msgServer2")
>? EVENTHANDLER( oMsg , x ) ** Code fails here, returns a .F.
>
>oMsg.callMyOnlyFunction()
>
>DO FORM main
>
>READ events
>
>** This class definition was drug & dropped from the object browser of the interface for Imsgserver in the "msg.msgServer" comm server.
>
>DEFINE CLASS myclass AS session && OLEPUBLIC
>
> IMPLEMENTS Imsgserver2 IN "msg.msgServer2"
>
> PROCEDURE Imsgserver2_myOnlyFunction() AS VARIANT
> * add user code here
>
> WAIT WINDOW "Hello"
>
> ENDPROC
>
> PROCEDURE Imsgserver2_callMyOnlyFunction() AS VARIANT
> * add user code here
> ENDPROC
>
>ENDDEFINE
>
>Here is the code for the prg that defines the com server:
>
>
>Define Class msgServer2 As Session OlePublic
>
> Procedure myOnlyFunction
>
> Endproc
>
> Procedure callMyOnlyFunction()
> This.myOnlyFunction()
> Endproc
>
>Enddefine
>
>I then compile this as a com server & it shows up as expected in the object browser, instantiates as expected but the eventhandler() function returns false ! Must there be a special set of com PEMs to allow event binding ?
>
>TIA
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform