problem:
The interface defined in C is as follows:
// ...
[Propget, ID (0), Helpstring ("Get User Nickname")] HRESULT NICKNAME ([OUT, RETVAL] BSTR * PVAL); [PropPut, ID (1), Helpstring ("Set User Nickname")] HRESULT NICKNAME BSTR newVal;
// ...
C # in COM Interop call, obtain the user nickname return error "Not set the object reference to the object instance", set the user nickname normal
Problem reason (not necessarily, you can solve the problem):
No memory is allocated to * PVAL when "getting user nickname"
Solution:
"[PropGet, ID (0), Helpstring (" Get User Nickname ")] HRESULT NICKNAME ([OUT, RETVAL] BSTR * PVAL);" Modified to:
[ID (0), Helpstring ("Get User Nickname")] HRESULT GETNICKNAME ([IN, OUT] BSTR * PVAL);
The intero package is called after the package:
// .....
String nickname = new string (new char [25]); // User nickname length is 25
User.getnickname (REF NICKNAME); // User For this purposeful object, Nickname is the user nickname value
// .....
===========================
The solution is not necessarily good. If you have a better solution, please leave a message, everyone discusses