General information
Category:
COM/DCOM and OLE Automation
Perhaps playing with the "as " clause when making the array?
I've used this to create safearrays of bytes (VT_UI1) passed to COM servers BY_REF. Maybe something like this, without the COMARRAY of course, might help.
*-- For COM
LOCAL ARRAY aTest[1000] as BYTE
aTest = chr(0)
COMARRAY(oServer,10(or 11, depending))
oServer.Method(@aTest)
Gary
>Hello All,
>
>I'm currently trying to create a VFP wrapper around a DLL that was designed specifically for Visual Basic. (Using VFP 6.0 sp5 on Win2K)
>
>95% of the DLL functions perfectly within VFP.
>
>I have, however, reached a stumbling block. One function of the DLL is expecting two parameters that I cannot seem to produce in Visual FoxPro. Luckily the DLL ships with examples for Visual Basic. The parameters are passed as character arrays in Visual Basic.
>
>The code to declare these variables in Visual Basic (version 6.0 sp5) is:
>
>' Input data type. 7 lines of 50 characters each.
>Type INPTYPE
> InputLine(6) As String * 50
>End Type
>
>' Output data type. 10 Lines of 100 characters each
>Type OUTTYPE
> OutputLine(10) As String * 100
>End Type
>
>' Global structures used for function
>Public gInputType As INPTYPE
>Public gOutputType As OUTTYPE
>
>The code in Visual Basic that calls the function looks like this:
>
>Declare Function MY_Function Lib "mylib.dll" ( _
> InputType As INPTYPE, OutputType As OUTYPE
>
>Return% = MY_Function(gInputType, gOutputType)
>
>Once the function is called, gOutputType is populated with a range of results.
>
>I've tried a number of things in VFP. When dimensioning VFP arrays of the required element count/string size I receive Fatal Exceptions. When I use padded strings to create buffers (REPLICATE(CHR(0), 50*7)) the function appears to function without error but nothing is populated in the output parameter.
>
>I believe what I need to do is emulate the Visual Basic Character arrays within VFP... and so my question is: Can it be done, and if so, can anybody point me in teh right direction?
>
>I've trawled through the struct.vcx but cannot seem find anything that might help.
>
>Any advice would be much appreciated.
>
>Thanks in advance for any advice provided.
>
>Kind Regards,
>
>Ben Sugden
Previous
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