SafeArrays (newbie)
-
Hi all, I have to pass a safearray to my DLL COM server. the method must size the array, and then fill with data. After that the client must use the data the server has inserted. I suspect my passed array is a copy of the one sent by the VB client, so my VB client does not access the data. how I have to modify my MIDL lines in order to have the safearray shared? I am using: [id(1), helpstring("method GetPosition")] HRESULT GetPosition(VARIANT arrayPosition); arrayPosition is a vector of double like this: Dim arrayPosition as Double (0 to 9) Dim a As New RunTimeAx a.GetPosition arrayPosition Debug.Print arrayPosition (0) Debug.Print arrayPosition (1) Debug.Print arrayPosition (2) Debug.Print arrayPosition (3) Could you pls help me? Thanx in advance
-
Hi all, I have to pass a safearray to my DLL COM server. the method must size the array, and then fill with data. After that the client must use the data the server has inserted. I suspect my passed array is a copy of the one sent by the VB client, so my VB client does not access the data. how I have to modify my MIDL lines in order to have the safearray shared? I am using: [id(1), helpstring("method GetPosition")] HRESULT GetPosition(VARIANT arrayPosition); arrayPosition is a vector of double like this: Dim arrayPosition as Double (0 to 9) Dim a As New RunTimeAx a.GetPosition arrayPosition Debug.Print arrayPosition (0) Debug.Print arrayPosition (1) Debug.Print arrayPosition (2) Debug.Print arrayPosition (3) Could you pls help me? Thanx in advance
You probably want
HRESULT GetPosition([in, out] VARIANT* pArrayPosition);
or even, if the caller won't ever pass anything interesting in:
HRESULT GetPosition([out, retval] VARIANT* pArrayPosition);
In the second case, you would transform your VB code to
Dim arrayPosition As Variant
Dim a As New RunTimeAx
arrayPosition = a.GetPosition
Debug.Print arrayPosition (0)
' etc(You might need to use
Set
, I haven't used VB for a while). Stability. What an interesting concept. -- Chris Maunder -
You probably want
HRESULT GetPosition([in, out] VARIANT* pArrayPosition);
or even, if the caller won't ever pass anything interesting in:
HRESULT GetPosition([out, retval] VARIANT* pArrayPosition);
In the second case, you would transform your VB code to
Dim arrayPosition As Variant
Dim a As New RunTimeAx
arrayPosition = a.GetPosition
Debug.Print arrayPosition (0)
' etc(You might need to use
Set
, I haven't used VB for a while). Stability. What an interesting concept. -- Chris MaunderThanx a lot Mike, when you come in Italy I'll offer you a beer. Thanx again. ;)