Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variant and SafeArray
Message
 
À
04/10/2011 07:34:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01525234
Message ID:
01525822
Vues:
74
>I think that it's possible to use SafeArray api
>http://msdn.microsoft.com/en-us/library/ms221234(v=VS.85).aspx

That *might* work for arrays of simple types like INTs but I don't think this will work for arrays of object (unless passed as untyped variants).

+++ Rick ---


>>Ah yes the good old problem of FoxPro and arrays that won't travel over COM :-) VFP arrays suck - the single worst feature in the FoxPro language.
>>
>>I remember struggling with this some time ago as well, and never found an acceptable solution. FoxPro can't properly create COM array types because FoxPro arrays are laid out differently. FoxPro can READ SafeArrays with the help of COMClassInfo but it can't create arrays that travel well over COM. For some reason I thought VFP 9 added some SYS() function that helped with this but I can't seem to find it in the help file now.
>>
>>I'm with Thomas on this: Create a wrapper in VB or C code and use that to build up a safe array and pass that through.
>
>I think that it's possible to use SafeArray api
>http://msdn.microsoft.com/en-us/library/ms221234(v=VS.85).aspx
>
>
>>While you're at it you might as well make that a generic SafeArray class that holds the array in VB (or whatever you use). I've done something similar for .NET interop in wwDotNetBridge here:
>>
>>http://www.west-wind.com/webconnection/wwClient_docs/_2mq0jxk83.htm
>>
>>Maybe the interface will give you some ideas...
>>
>>+++ Rick ---
>>
>>
>>
>>>Hello All
>>>
>>>I am trying to use OLE to automate a 3rd party application. Everything works fine except a single function call that requires some variables to passed by reference. Here is the example:
>>>
>>>Function Retrieve(ByVal Count As Long, ByRef Date As Variant, ByRef Open As Variant, ByRef High As Variant, ByRef Low As Variant, ByRef Close As Variant, ByRef Volume As Variant, ByRef OpenInt As Variant) As Long
>>>
>>>
>>>No matter what variable type I pass I always get a "type mismatch" error message. I contacted their support department who came back with this response:
>>>
>>>This function requires that the language from which you are calling it
>>>supports SAFEARRAY data type that is used by Retrieve to return data.
>>>Visual Basic for Applications can do that. C++ can do that.
>>>Scripting languages (JScript/VBScript) don't offer this data type.
>>>

>>>So my question - is there a way to handle this in VFP9?
>>>
>>>TIA
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform