General information
Category:
ActiveX controls in VFP
Title:
Accessing a foxpro array from within a VB COM Server
First let me take a moment to thank everyone who has been helping me thus far on my journey! (Randy, Christof, Ed, Mike, etc...) Now I have yet another interesting problem. :)
I am writing a COM Server with VB and tying it to our favorite language, VFP. Inside of a method on my COM server I need to run an ACLASS command.
Here is a snippet of my code to help illustrate...
>>>> IN VFP <<<<
PUBLIC ox
PUBLIC myarray[1] && ALSO tried LOCAL myarray[1]
ox = CREATEOBJECT('form')
ox.ADDOBJECT('vbcomtest','myocx', 'vbcomtest.ctlvbcomtest')
loTemp = CREATEOBJECT('Custom')
?comarray(ox.vbcomtest.object,11)
? ox.vbcomtest.DoAClass(loTemp, "loTemp", @myarray, "myarray")
? ALEN(myarray)
DEFINE CLASS myocx AS OLECONTROL
ENDDEFINE
>>>>> IN VB COM Server <<<<<<
Public Sub DoAClass(toObject As Variant, tcObject As String, tcaAClass() As Variant, tcArrayName As String, toVFP As Variant)
Dim lcCommand As String
>>>> 'Do stuff
>>>> 'Do stuff
>>>> 'Do stuff
lcCommand = "? ACLASS(" & tcArrayName & ", " & tcObject & ")"
Call MsgBox(lcCommand)
Call CallByName(toVFP, "DoCmd", VbMethod, lcCommand)
>>>> 'Do stuff
>>>> 'Do stuff
>>>> 'Do stuff
End Sub
When the CallByName function runs within VB it displays the correct result from the AClass command onto the VFP desktop. (I checked it by running the same string from with VFP). So it appears that AClass is running correctly but it is not sending the results into "myarray"
What I wanted to do was send in a reference to the "myarray" array and its name as a string. In this way I could build a vfp string to execute through the _VFP object reference, and have the array reference I've sent in correctly point to the results.
How can I run AClass within a VB COM Server and get access to the resulting array?
Any help would be greatly appreciated!
-- Chris
PS: Running AClass and sending in the results array to the VB COM Server's method is NOT AN OPTION. :)
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only