G
George
Hi all,
I have VB applicatoin , which calls a function in VC++ DLL
Arguement of function is a one dimensional string array.
Array will get filled in VC++ dll function.
I have written the programme given below.
But I am unable to get the array elements from VC++.
Programme is given below.
VC++ COM
/*****************************************/
STDMETHODIMP CTest111CL::myFun(SAFEARRAY **ppOutputArray)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
HRESULT hresult;
SAFEARRAYBOUND aDim[1] ;
aDim[0].lLbound = 0;
aDim[0].cElements = 3;
BSTR HUGEP *pbstr;
*ppOutputArray = SafeArrayCreate(VT_BSTR , 1, aDim);
hresult=SafeArrayAccessData(*ppOutputArray,(void HUGEP**)&pbstr);
pbstr[0] = SysAllocString(OLESTR("SOURCE_VA"));
pbstr[1] = SysAllocString(OLESTR("ACV"));
pbstr[2] = SysAllocString(OLESTR("10"));
SafeArrayUnaccessData(*ppOutputArray);
return S_OK;
}
/**********************************************/
VB Application
---------------
''''''''''''''''''''''''''''
Dim i As Test111CL
Private Sub Command1_Click()
Dim arr_str(3) As String
Set i = New Test111CL
i.myFun arr_str()
MsgBox arr_str(1)
End Sub
''''''''''''''''''''''''''
MsgBox arr_str(1) , The message Box shows and empty string.
How can I rectify it. Please help me.
Thanks
George
I have VB applicatoin , which calls a function in VC++ DLL
Arguement of function is a one dimensional string array.
Array will get filled in VC++ dll function.
I have written the programme given below.
But I am unable to get the array elements from VC++.
Programme is given below.
VC++ COM
/*****************************************/
STDMETHODIMP CTest111CL::myFun(SAFEARRAY **ppOutputArray)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
HRESULT hresult;
SAFEARRAYBOUND aDim[1] ;
aDim[0].lLbound = 0;
aDim[0].cElements = 3;
BSTR HUGEP *pbstr;
*ppOutputArray = SafeArrayCreate(VT_BSTR , 1, aDim);
hresult=SafeArrayAccessData(*ppOutputArray,(void HUGEP**)&pbstr);
pbstr[0] = SysAllocString(OLESTR("SOURCE_VA"));
pbstr[1] = SysAllocString(OLESTR("ACV"));
pbstr[2] = SysAllocString(OLESTR("10"));
SafeArrayUnaccessData(*ppOutputArray);
return S_OK;
}
/**********************************************/
VB Application
---------------
''''''''''''''''''''''''''''
Dim i As Test111CL
Private Sub Command1_Click()
Dim arr_str(3) As String
Set i = New Test111CL
i.myFun arr_str()
MsgBox arr_str(1)
End Sub
''''''''''''''''''''''''''
MsgBox arr_str(1) , The message Box shows and empty string.
How can I rectify it. Please help me.
Thanks
George