Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Variant/Long to COM Object
Message
De
02/12/2008 10:13:09
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, États-Unis
 
 
À
01/12/2008 19:01:33
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Application:
Desktop
Divers
Thread ID:
01364969
Message ID:
01365125
Vues:
16
VFP's COM handling changed after VFP 7. Even though you aren't dealing with arrays, If you feel like trying something completely off the wall in VFP 9... a LONG shot, so to speak!

*-- Should be seen by COM object as VT_UI4 VT_BYREF
DIMENSION aTest[1] as LONG
aTest[1]=0
oComObj(@aTest[1])

*-- Should be seen by COM object as VT_ARRAY VT_UI4 VT_BYREF
COMARRAY(oComObj, 11)
oComObj(@aTest)

Sometimes something goofy works.


Gary

>I would expect that to work, but it doesn't. I found related info at the link below. Unless something changed since VFP 6, I think I'm gonna have to use the VB wrapper.
>
>http://support.microsoft.com/kb/177575
>
>Thanks.
>
>>Try
>>
>>Variant = SPACE(10)
>>Long = 0
>>* Call the COM object
>>
>>
>>>I'm working with a COM interface that accepts a couple of parameters passed by reference. The component expects the parameters to be of types Variant and Long. Is there any way to tell VFP to explicitly create variables of those types? I realize that VFP variables are inherently variant, but Fox does assign a type to them. A variable that is declared but not assigned is by default a logical variable. I don't know how to create a variant type in VFP. Perhaps type Integer or Numeric will work for the Long variable, but I won't know unless I can get past the "Type Mismatch" error for the variant.
>>>
>>>The component designers obviously had VB in mind when creating the interface. As a test, I created a VB6 wrapper to the function, and it works as long as I declare the variables as Variant and Long. If I change them to any other type (String, Integer, etc.), it doesn't work. I'd like to do away with the VB wrapper if possible.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform