473,221 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

Accessing VC++ interface methods from C#

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
Mar 6 '08 #1
3 2095
On Mar 6, 11:36 am, "Shrihari Devji" <srihari.de...@in.bosch.com>
wrote:
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
Mar 7 '08 #2
<gr***********@gmail.comwrote in message
news:a4**********************************@u69g2000 hse.googlegroups.com...
On Mar 6, 11:36 am, "Shrihari Devji" <srihari.de...@in.bosch.com>
wrote:
>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

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

Regards
Shrihari Devji
Mar 10 '08 #3
On Mar 10, 1:53*pm, "Shrihari Devji" <srihari.de...@in.bosch.com>
wrote:
<grps.gobin...@gmail.comwrote in message

news:a4**********************************@u69g2000 hse.googlegroups.com...
On Mar 6, 11:36 am, "Shrihari Devji" <srihari.de...@in.bosch.com>
wrote:
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

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

Regards
Shrihari Devji
Hi,
Sorry for this late reply. S_FALSE is not exactly a failure.
Exceptions will be raised only when the severity bits are set in the
HRESULT. If you want to get exceptions, you may have to use anyone of
the following

E_UNEXPECTED - 8000FFFF Catastrophic failure
E_NOTIMPL - 80004001 Not implemented
E_OUTOFMEMORY 8007000E Out of memory
E_INVALIDARG 80070057 One or more arguments are not valid
E_NOINTERFACE 80004002 Interface not supported
E_POINTER 80004003 Pointer not valid
E_HANDLE 80070006 Handle not valid
E_ABORT 80004004 Operation aborted
E_FAIL 80004005 Unspecified error
E_ACCESSDENIED 80070005 General access denied

regards,
goB
Apr 9 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rookie | last post by:
Hi I had a couple of questions: 1.)I am trying to invoke member functions of a class which is coded in VC++ from a UI that is coded in C#. Firstly, if I am not mistaken I think this can be...
2
by: vemulakiran | last post by:
Hi all, I have doubt regarding .NET. I have a tool which was developed on VC++ 6.0(Win32 Application ). The application communicates with library (API) which was developed on VC++ 6.0 called core...
1
by: Steve | last post by:
We are considering the ways to migrate our VC++ 6.0 applications to .NET platform. It would be nice to rewrite them completely in C#, but due to the time constraints this option is out of...
1
by: vemulakiran | last post by:
Hi all, I have doubt regarding .NET. I have a tool which was developed on VC++ 6.0(Win32 Application ). The application communicates with library (API) which was developed on VC++ 6.0 called core...
6
by: Earl Teigrob | last post by:
I am writing an application that dynamically loads user controls at run time based on user options. I would like to give my users the ability to build their own user controls and add them to my...
1
by: Jeff Smith | last post by:
Can I load custom web user controls dynamically and access the properties and methods without having to explicitly define custom control types (example 2 below). I have custom web control named...
1
by: Rob C | last post by:
We have a client/server application that is written in VC++/MFC. We are trying to integrate with a 3rd party product that exposes its data through a web service. I am trying to figure out the...
17
by: Fabry | last post by:
Hi All, I'm new of this group and I do not know if this is the correct group for my question. I have a DLL with its export library (.lib) wrote in Borland C++ 6. In borland everything is OK and...
53
by: Edward Diener | last post by:
Why bother having Stan Lippman and Herb Sutter created a C++/CLI language for .Net development when Microsoft, and the VC++ development team, are so clearly intent on limiting .Net development with...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.