ะก# COM DLL Interface:
public interface IShowDialog
{
void showMessage(byte[] array);
}
and call it in unmanaged C++ application:
SAFEARRAY *array;
array = SafeArrayCreateVector(VT_BSTR, 0, 1);
long lidx = 0;
SafeArrayPutElement( array, &lidx, SysAllocString(L"test") );
hr = dlg->showMessage(array);
Result: 0x80131533 - COR_E_SAFEARRAYTYPEMISMATCH
The COM interface needs to be called from native code with a SAFEARRAY
whose contents are VT_I1
instances. You are providing instead VT_BSTR
values and hence receiving the error.
You need to convert the string value into VT_I1
values and put those into the array.
EDIT
The proper in C++ name is VT_I1
and not VT_BYTE
User contributions licensed under CC BY-SA 3.0