Accessing VC++ interface methods from C#

  • Thread starter Thread starter Shrihari Devji
  • Start date Start date
S

Shrihari Devji

Hello

I have a windows service developed in VC++. It exposes some
interface methods. I need to access them from C# client.
I cant add the reference since it might be running on some other
system. So I used activators to access the methods with the help of
InvokeMember function. But now the problem is I am not able to get the S_OK
or S_FALSE result values from Interface method. How to get this value. Or is
there any other way to solve the problem I have.

Regards
Shrihari Devji
RBEI Bangalore
 
Hello

I have a windows service developed in VC++. It exposes some
interface methods. I need to access them from C# client.
I cant add the reference since it might be running on some other
system. So I used activators to access the methods with the help of
InvokeMember function. But now the problem is I am not able to get the S_OK
or S_FALSE result values from Interface method. How to get this value. Or is
there any other way to solve the problem I have.

Regards
Shrihari Devji
RBEI Bangalore

Hi there,
Generally, the return values S_OK, E_FAIL and other S_FALSE
will be consumed by the .Net's Runtime Callable Wrapper(RCW). If the VC
++ service is returning E_FAIL, the RCW will convert that as an
Exception and throws it to the C# client. so it is better to provide
try...catch blocks to know the return types.

goB
 
Hi there,
Generally, the return values S_OK, E_FAIL and other S_FALSE
will be consumed by the .Net's Runtime Callable Wrapper(RCW). If the VC
++ service is returning E_FAIL, the RCW will convert that as an
Exception and throws it to the C# client. so it is better to provide
try...catch blocks to know the return types.

goB

Hi

But we are not getting an excetption when it returns S_FALSE. So is
there any way to get it??

Regards
Shrihari Devji
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top