Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing arrays to .NET and getting arrays back
Message
 
À
02/05/2011 15:52:58
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01509041
Message ID:
01509327
Vues:
63
>Also discovered C# public methods that return nullable types ( long? ) are not seen by vfp

Actually any generic types are not seen by FoxPro. Again wwDotNetBridge lets you get at those via indirect referencing, which admittedly is still ugly, but at least works :-)

+++ Rick ---

>
>Glad I don't have to do a lot of this interop stuff, but I think next time it will be a lot easier.
>
>Thanks for the stuff below - I will definitely take it apart.
>
>
>
>>SNIP
>>
>>(Sorry for the sloppy code, but I think you get the picture. Try referencing your array like so to see if it is really there or not...)
>>
>>Can you just return an object? This works for me:
>>See section: "Passing Complex types between Visual FoxPro and .NET:"
>>http://www.west-wind.com/presentations/dotnetfromVfp/DotNetFromVfp_ComplexObjects.asp
>>
>>Another option, when I get a collection hanging on an object from .net (passed to VFP via an event firing), I have to reference it like so or else I cannot "see" it:
>>
>>*--Event that is hooked up and fires:
>>PROCEDURE INETAPIEvents_QuestAnsEvent(arg AS VARIANT) AS VOID
>>*arg object is passed to vfp via com interop event firing  - it has collections as properties (remember it is zero-based in .net)
>>*VFP Code in event to see questions and answers collection passed from .net:
>>*arg object is passed to vfp via com interop event firing  - it has collections as properties (remember it is zero-based in .net)
>>*VFP Code in event to see questions and answers collection passed from .net:
>>IF TYPE("arg") = "O"  AND ...  && etc skip the stupid stuff you know
>>   IF TYPE("arg.myObject") = "O" AND TYPE("arg.myObject.myCollection") = "O" AND TYPE("arg.myObject.myCollection.count") = "N" AND arg.myObject.myCollection.COUNT > 0
>>	FOR I = 0 TO arg.myObject.myCollection.COUNT-1
>>		IF TYPE("arg.myObject.myCollection.ITEM[m.i].Questions") = "O" AND arg.myObject.myCollection.ITEM[m.i].Questions.COUNT > 0  && Are there questions and answers?
>>			FOR iq = 0 TO arg.myObject.myCollection.ITEM[m.i].Questions.COUNT - 1
>>				RELEASE loTemp
>>				loTemp = arg.myObject.myCollection.ITEM[m.i].Questions.ITEM[m.iq]
>>				IF TYPE('ALEN(loTemp.Answers,1)') = "N"
>>					FOR ia = 1 TO ALEN(loTemp.Answers,1)
>>						IF .F.
>>							DIMENSION laAnswers[1]
>>						ENDIF
>>						RELEASE laAnswers
>>						laAnswers = loTemp.Answers
>>					ENDFOR
>>				ENDIF
>>
>>
+++ 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
Répondre
Fil
Voir

Click here to load this message in the networking platform