PC Review


Reply
Thread Tools Rate Thread

COM component's C++ client works but .net client doesn't?

 
 
Simon LU
Guest
Posts: n/a
 
      25th Jul 2003
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


 
Reply With Quote
 
 
 
 
Kumar Gaurav Khanna [.NET MVP]
Guest
Posts: n/a
 
      27th Jul 2003
Hi!

Typically, when you TLBIMP a COM class, the class is actually suffixed with
the "Class" string in its .NET version, while the original class name is
actually made to be an interface. So try this:

CxValueObject d = new CxValueObjectClass();

Regards,
Gaurav Khanna

--
----------------------------------------------------------------------------
----------
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/
OpSupport - Spelunking Rotor
http://opsupport.sscli.net/
----------------------------------------------------------------------------
----------

"Simon LU" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Secure Webdav XP client works, Vista doesn't xrbbaker Windows Vista General Discussion 1 27th Jan 2010 10:07 PM
Client for Microsoft Networking - Client component =?Utf-8?B?VEg=?= Windows XP Networking 1 24th Jan 2006 09:19 PM
Printer redirection works with XP client but not 2000 client on 20 =?Utf-8?B?QkQ=?= Microsoft Windows 2000 Terminal Server Clients 0 3rd Mar 2005 11:33 AM
Local printer works in Win2K RDP client, not on XP Pro RDP client Gordon Fecyk Windows XP Work Remotely 0 16th Dec 2004 11:47 PM
DCOM application works with XP client and not Win2K client Nick Gebbett Microsoft Windows 2000 Networking 0 16th Sep 2003 02:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:20 PM.