S
Simon LU
I have a COM component in ATL, one of its method's IDL define is as the
following:
HRESULT SetValue(long a, [in] long* b,[in]string* c, [in]VARIANT* d,
[out,retval] ConfirmVal e);
here ConfirmVal is a Enum define by IDL.
The VC++ client has no problem to call it by using smart pointer as the
followings:
long a=0;
long b=-1;
CComBSTR c=L"NAME";
d = ICxValuePtr(__uuidof(ICxValue)); //d is another smartpointer, it is a
IDispatch interface in IDL
ConfirmVal e;
ptr->SetValue(a,&b,&c,d,&e)
....
When my C# client calls it as the followings, it throws COMException with
"Unspecified error":
int a=0;
int b=-1;
string c="NAME";
CxValueObject d = new CxValueObject(); //CxValueObject is the class
corresponding to ICxValue interface in the assembly converted by tlbimp.exe
ConfirmVal e;
obj.SetValue(a, ref b, ref c, d, out e); //Throws COMException with
"Unspecified error" here
....
The signature of SetValue in C# in the assembly is void SetValue(int,ref
int,ref string,object,out ConfirmVal).
Can anybody give a clue?
Thanks in advance.
Simon
following:
HRESULT SetValue(long a, [in] long* b,[in]string* c, [in]VARIANT* d,
[out,retval] ConfirmVal e);
here ConfirmVal is a Enum define by IDL.
The VC++ client has no problem to call it by using smart pointer as the
followings:
long a=0;
long b=-1;
CComBSTR c=L"NAME";
d = ICxValuePtr(__uuidof(ICxValue)); //d is another smartpointer, it is a
IDispatch interface in IDL
ConfirmVal e;
ptr->SetValue(a,&b,&c,d,&e)
....
When my C# client calls it as the followings, it throws COMException with
"Unspecified error":
int a=0;
int b=-1;
string c="NAME";
CxValueObject d = new CxValueObject(); //CxValueObject is the class
corresponding to ICxValue interface in the assembly converted by tlbimp.exe
ConfirmVal e;
obj.SetValue(a, ref b, ref c, d, out e); //Throws COMException with
"Unspecified error" here
....
The signature of SetValue in C# in the assembly is void SetValue(int,ref
int,ref string,object,out ConfirmVal).
Can anybody give a clue?
Thanks in advance.
Simon