473,412 Members | 5,714 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,412 software developers and data experts.

implement unmanaged interface

Hi,

Can somebody suggest me, how can I implement a vc++ interface in C#.net.
This interface has method CallMe( ) which is used as a CallBack from my main
application.

Thanks,
Baji.
Nov 14 '07 #1
4 4216
Baji,

You can't. It has to be a COM interface, or a managed interface written
in C++/CLI. Otherwise, you have to implement it in C++ and then call into
managed code.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Baji." <Ba**@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.com...
Hi,

Can somebody suggest me, how can I implement a vc++ interface in C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.

Thanks,
Baji.

Nov 14 '07 #2
Yes,

It is a COM interface. & has a method CallMe( ). I need to implement this
interface in C# application. And, this method will be called by unmanaged
application.

can you suggest me something here?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Baji,

You can't. It has to be a COM interface, or a managed interface written
in C++/CLI. Otherwise, you have to implement it in C++ and then call into
managed code.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Baji." <Ba**@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.com...
Hi,

Can somebody suggest me, how can I implement a vc++ interface in C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.

Thanks,
Baji.


Nov 14 '07 #3
Baji,

If it is a COM interface, you should be able to add a reference (on the
COM tab) to that dll (or the type library that stores the interfaces) and
VS.NET will generate managed representations of the interface for you.

Or, if you want to do this by hand, you can use the TLBIMP utility that
comes with the framework.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Baji." <Ba**@discussions.microsoft.comwrote in message
news:EE**********************************@microsof t.com...
Yes,

It is a COM interface. & has a method CallMe( ). I need to implement this
interface in C# application. And, this method will be called by unmanaged
application.

can you suggest me something here?

"Nicholas Paldino [.NET/C# MVP]" wrote:
>Baji,

You can't. It has to be a COM interface, or a managed interface
written
in C++/CLI. Otherwise, you have to implement it in C++ and then call
into
managed code.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Baji." <Ba**@discussions.microsoft.comwrote in message
news:1F**********************************@microso ft.com...
Hi,

Can somebody suggest me, how can I implement a vc++ interface in
C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.

Thanks,
Baji.



Nov 14 '07 #4
Nicolas,

I am able to add the dll as a reference & also I have derived my class from
the interface. & the DEV env has also added the interface structure etc., to
my code. Now the interface method :CallMe() need to be called by my unmanaged
application. So, how can I achieve this ?

I am usinng VS 2008. After compilation am putting the dll into GAC & also
registering the tlb

I never get a break on the interface method. I think I am not doing in the
right way, can you suggest me ?

Thanks,
Baji.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Baji,

If it is a COM interface, you should be able to add a reference (on the
COM tab) to that dll (or the type library that stores the interfaces) and
VS.NET will generate managed representations of the interface for you.

Or, if you want to do this by hand, you can use the TLBIMP utility that
comes with the framework.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Baji." <Ba**@discussions.microsoft.comwrote in message
news:EE**********************************@microsof t.com...
Yes,

It is a COM interface. & has a method CallMe( ). I need to implement this
interface in C# application. And, this method will be called by unmanaged
application.

can you suggest me something here?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Baji,

You can't. It has to be a COM interface, or a managed interface
written
in C++/CLI. Otherwise, you have to implement it in C++ and then call
into
managed code.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Baji." <Ba**@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.com...
Hi,

Can somebody suggest me, how can I implement a vc++ interface in
C#.net.
This interface has method CallMe( ) which is used as a CallBack from my
main
application.

Thanks,
Baji.


Nov 15 '07 #5

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

Similar topics

2
by: Billy Porter | last post by:
Greetings, I got a class that wraps the System.Data.SqlClient.SqlConnection class (no COM interaction). I'm not sure if I'm supposed to implement the IDisposable pattern for this wrapper or not....
7
by: Lev | last post by:
Hi, I have an unmanaged pointer to a class that I want to hold in a managed class. I pass the pointer (from unmanaged code) in the constructor of the managed class, and at that point it has...
1
by: Manny Silva | last post by:
Hi, I used ATL to create a COM library that does a lot of work via IStreams that are passed in. I had hoped to test this library using managed C++. I added my COM library as a reference and vc...
3
by: Tommy Svensson \(InfoGrafix\) | last post by:
I've been instructed to work againt a huge unmanaged C++ API from a C# application. Now, the only way, as I've understood it, is to go the Managed Extensions for C++ way. This means I have to...
1
by: anders | last post by:
I call from managed C++ a DCOM server interface method that takes a callback interface as parameter. I cannot figure out how to implement such a callback object in managed C++. The callback...
1
by: MLM450 | last post by:
I have created a .NET component in C# that has 2 interfaces. One is an incoming interface with methods being exposed to COM-aware clients. The other is an outgoing event interface that the...
0
by: krzys | last post by:
After hours of browsing I can't find any hints on how to implement a COM component using a managed C++ class. In C# this is trivial, you import the interface like below and just implement it. ...
2
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the...
4
by: cgarcia0117 | last post by:
For any class I write in C# that has a member variable that implements IDisposable my class implements the IDisposable pattern. I do this to guarantee the reference to the member is explicitly...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.