Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass a byte array to a VFP COM server
Message
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01504853
Message ID:
01504879
Views:
70
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
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform