In other parts of my COM server, I pass parameters by reference. Here is another procedure in the server that works fine both from VFP and C++ clients:
PROCEDURE GetDatFilesFromvFBDPatVisits(sFBDDataSource AS String , nPatientNo AS Integer @, nVisitID as Integer @, ;
nFileID AS Integer @, sFilename AS String @)
And, I call this by
Result = Thisform.oNPVD.GetDatFilesFromFBDPatVisits("FBD on JIM", @nPatientNo, @nVisitID, @nFileID, @cFilename)
But, none of these are byte arrays.
>In VFP you need to call it by reference, e.g.
>
>DIMENSION aBlobData[nFileSize] AS Byte
>thisform.oNPVD.GetvFBDBlob(nFileID, @aBlobData) -- array populated with .F. at present
>
>However, I think there may be problems related with COM and passing parameters by reference - I don't recall right now.
>
>>>>Naomi,
>>>>
>>>>Thanks for your quick response.
>>>>
>>>>I have done the things you suggested. Again, it works when I create the object directly for the PRG file. When I build the COM EXE, i no longer get the error that aBlobData is undefined. However, at runtime, I get the error in the FOR loop saying "Invalid subscript reference".
>>>>
>>>>Jim
>>>>
>>>>
>>>Can you post code that invokes this function and also the code that checks the array size.
>>
>>Here is the code that invokes the function:
>>
>>DIMENSION aBlobData[nFileSize] AS Byte
>>thisform.oNPVD.GetvFBDBlob(nFileID, aBlobData)
>>
>>
>>Here is the code at the beginning of GetvFBDBlob:
>>
>>FUNCTION GetFBDBlob(nFileID AS Integer, aBlobData AS Byte ) AS Integer
>> EXTERNAL ARRAY aBlobData
>> LOCAL nResult AS Integer, nBlobSize AS Integer
>> MESSAGEBOX("length of aBlobData: " + STR(ALEN(aBlobData)))
>>
>>
>>When I build the COM, and then run my VFP client, I get an error message saying "ABLOBDATA is not an array"
>>
>>I have tried calling with and without '@" in the call: GetvFBD(nFileID, @aBlobData) and GetvFBD(nFileID, aBlobData). Get the same error message.
>>
>>
>>Jim