Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing an array of objects to a COM object from VFP
Message
De
06/12/2005 13:08:03
 
 
À
06/12/2005 11:32:55
Harold Rappold
Melange Computer Services
Lansing, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01075356
Message ID:
01075436
Vues:
16
Hello,

"* create locals to explicitly set the type of SalesItem properties
local lngCid as Long, lngQty as Long, lngSession as Long, dblAmount as Double, bolUpSess as Boolean, lngUpSellStaffId as Long, bolCrystalBall as Boolean"

you don't need to do this, setting the properties on the object directly should work just fine, VFP doesn't respect the types you specified in the AS clause anyway.

The are only 2 situations where the AS clause is useful.
1. When you write your own COM object in VFP, the AS clause specifies the type that is written to the type library, and therefore is seen by other programming languages.
2. If you declare a variable as a COM object of some specific type, VFP is able to early bind to it instead of using late binding, giving you a performance gain

"* setup additional paramters that are passed to Sell() method
local lngReceiptNumber as Long, lngDeviceType as Long, ;
lngHighestSold as Long, strCustId as String, ;
bytSellingSession as Byte, intUnitNumber as Integer"

same as above, you can pass the values directly.

there are still some rare bugs in VFP when calling method's on COM objects.
Most of the time you can overcome these by calling the method on an intermediate "interface object".

e.g. try this:
loInterface = GETINTERFACE(loMyObj,'ITheInterfaceThatImplementsYourMethod')
&& you'll have to look up the interface name in the Object browser
intUnitNumber = 0
lnResult = loInterface.Sell(@laItems,1,0,6,"",1,@intUnitNumber)
? "Result:" + str(lnResult)
? "Unit:" + str(intUnitNumber)
"What am I doing wrong??"
Nothing, VFP is just buggy.

Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform