Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFPCOM ExportEvents
Message
De
16/04/1999 15:53:03
 
 
À
16/04/1999 15:22:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00209137
Message ID:
00209166
Vues:
40
>In another words VFP COMs dont have event interface?
>Mark

What he is saying is, if you write a VFP com server, you already have the ability to write code in the Event methods...

For example... when your VFP object instanitates the Init event fires... you can, when you create that class, open the Init Event method and put code in it.

But, a COM server that you didn't write will have events that fire too... previously you had no way to be informed that the event fired.

For example... lets say that you are provided with a C++ COM component written by your company... In that server there was the DoorOpen event. That event fires when an employee opens a door of the building with a key card.

So, you are writting a FoxPro program to log that data to a table.

You write your program... you might wirte something like...

oX = creatobject('Security.Doors')

Ok.. so, you have a reference to the object... now, whenever a Door opens the door event fires... in VB you could write a function like...

function oX_dooropen(Time as DateTime, EmployeeID as Int)
return

Well... how do you do that in VFP? You can't until NOW...

So, you can write a class:

********
DEFINE DoorLogger as custom

function DoorOpen

blah blah

endfinc

enddefine

************

Now, after you create your reference to the comobject:

oX = createobj('Security.Doors')
oMyClass = createobj('DoorLogger')

** bind the com object to your vfp class...

oVFPCOM = CREATEOBJECT('vfpcom.comutil')

oVFPCOM.BindEvents(oX, oMyClass )

Now... whenever the DoorOpen event fires it will run your DoorOpen code in your class.

COOL HUH!!!!

BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform