Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Working with Safe Arrays?
Message
From
05/08/2004 14:34:58
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, United States
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00930360
Message ID:
00931111
Views:
21
Sergey,

oComObj(Date()) && VT_DATE
oComObj(@Date()) && Boom! as you would expect

dDate = date()
oComObj(dDate) && VT_DATE
oComObj(@dDate) && VT_DATE|VT_BYREF

DIMENSION aDate[5] as DATE
aDate = date()
oComObj(aDate) && VT_DATE
oComObj(@aDate) && VT_ARRAY|VT_DATE|VT_BYREF

DIMENSION aDate[5] && No "as"
aDate = date()
oComObj(aDate) && VT_DATE
oComObj(@aDate) && VT_ARRAY|VT_VARIANT|VT_BYREF

Note: These results are slightly different from below regarding the @ sign. The test server was thrown together and I think it doesn't clear it's memory properly. For the above test, I released it between tests. It looks like without the @, the server just receives the value instead of the array, which is what we would expect.


Gary


>Gary,
>
>
>How do you pass a date in this scenario?
>
>>BTW, just to continue a thread almost no one in the VFP community cares about<g>, CreateBinary() will create a string that can be passed as a safearray of VT_UI1 as in cStr = CreateBinary('123456578'), but cStr cannot be passed BY_REF even using ComArray(oComObject,10). Only by first creating an array as byte and filling it can we pass by reference as some COM servers require for passing data back and forth.
>>
>>Maybe this obscure info will save someone some grief sometime.
>>
>>Disclaimer: Since I didn't write the COM data thingy, I don't know exactly what it's doing under the covers, but it seems to work, e.g., passing a date returns VT_DATE, 1234 returns VT_I4, etc.
>>
>>ComArray(oComObj,10)
>>DIMENSION MyArray[5] as BYTE
>>MyArray[1] = '1'
>>MyArray[2] = '2'
>>MyArray[3] = '3'
>>MyArray[4] = '4'
>>MyArray[5] = '5'
>>MyStr = CreateBinary('12345')
>>
>>oComObj(MyStr) && VT_ARRAY|VT_UI1
>>oComObj(@MyStr) && VT_ARRAY|VT_UI1
>>oComObj(MyArray) && VT_ARRAY|VT_UI1- still seen as array even w/o the @
>>oComObj(@MyArray) && VT_ARRAY|VT_UI1|BY_REF
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform