473,668 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

COM -> CSharp Interface generator

Does anybody know of a tool of some sort that can generate a C# interface
from a COM interface? I need to pull a ton of interfaces out of an existing
application and it sure would be lot nicer to get at least a rough headstart
with these interfaces.

Is there such thing before I sit down and write somehting like this on my
own?
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web

Nov 16 '05 #1
12 3199
"Rick Strahl [MVP]" <ri********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Does anybody know of a tool of some sort that can generate a C# interface
from a COM interface? I need to pull a ton of interfaces out of an existing application and it sure would be lot nicer to get at least a rough headstart with these interfaces.

Is there such thing before I sit down and write somehting like this on my
own?

Hi Rick,

I haven't seen anything that does that. However, here's an idea that I'll
throw out there to see if it will save you some work. What if you used
reflection on the tlbimp.exe generated proxy to pull out the interfaces and
generate code from there.

Joe
--
http://www.csharp-station.com
Nov 16 '05 #2
doesn't visual studio 7.1 have this built in? where it imports an com
interface for you to use in c#?
"Rick Strahl [MVP]" <ri********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Does anybody know of a tool of some sort that can generate a C# interface
from a COM interface? I need to pull a ton of interfaces out of an existing application and it sure would be lot nicer to get at least a rough headstart with these interfaces.

Is there such thing before I sit down and write somehting like this on my
own?
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web

Nov 16 '05 #3
Yeah TLBIMP does, but it doesn't generate the source for it. It's all or
nothing. I need to pull in a few interfaces of a huge type library and don't
want the baggage of a 7meg file...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"PEACEMAKER " <do**********@y o.mamas.hairy.a ss.com> wrote in message
news:eZ******** ******@TK2MSFTN GP12.phx.gbl...
doesn't visual studio 7.1 have this built in? where it imports an com
interface for you to use in c#?
"Rick Strahl [MVP]" <ri********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Does anybody know of a tool of some sort that can generate a C# interface from a COM interface? I need to pull a ton of interfaces out of an

existing
application and it sure would be lot nicer to get at least a rough

headstart
with these interfaces.

Is there such thing before I sit down and write somehting like this on my own?
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web


Nov 16 '05 #4
Hi Joe,

yeah, I know I can do that. I was hoping to avoid that somehow.

Maybe the way to do this is to use TLBIMP and then decompile the code it
gens? I suspect that sin't going to work on that code because of all the
Attributes requirement to the COM interop stuff work.
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Joe Mayo [C# MVP]" <jm***@nospamAt CSharpDashStati on.com> wrote in message
news:Ou******** *****@TK2MSFTNG P11.phx.gbl...
"Rick Strahl [MVP]" <ri********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Does anybody know of a tool of some sort that can generate a C# interface from a COM interface? I need to pull a ton of interfaces out of an existing
application and it sure would be lot nicer to get at least a rough

headstart
with these interfaces.

Is there such thing before I sit down and write somehting like this on my own?

Hi Rick,

I haven't seen anything that does that. However, here's an idea that I'll
throw out there to see if it will save you some work. What if you used
reflection on the tlbimp.exe generated proxy to pull out the interfaces

and generate code from there.

Joe
--
http://www.csharp-station.com

Nov 16 '05 #5
"Rick Strahl [MVP]" <ri********@hot mail.com> wrote in message
news:OB******** ******@TK2MSFTN GP11.phx.gbl...
Hi Joe,

yeah, I know I can do that. I was hoping to avoid that somehow.

Maybe the way to do this is to use TLBIMP and then decompile the code it
gens? I suspect that sin't going to work on that code because of all the
Attributes requirement to the COM interop stuff work.

That's a thought. I haven't used the Anakrino decompiler, but have seen
some people recommend it:

http://www.saurik.com/

Joe
--
http://www.csharp-station.com
Nov 16 '05 #6
Rick,

Aurigma had a tool that generated source code instead of compiled
assemblies (at http://www.aurigma.com/Products/COMtoNET/) that used to
be available in public beta, but it doesn't appear to be anymore.

You can't use Reflection to build your own interop assembly
decompiler, because Reflection doesn't return interop related metadata
(at least not in pre-Whidbey versions).

I've been working on a decompiler that uses the unmanaged metadata
APIs instead. It's not finished, but it may be good enough if you're
interested.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #7
Our Decompiler.NET product fully supports generating COM interface
sources from compiled .NET assemblies. It reads custom attributes and
metadata such as FieldMarshal Info, Struct Layout attributes,
DllImport attributes, etc. directly from the PE file. You can download
a free trial version and see how well it works from
http://www.junglecreatures.com/

Jonathan Pierce
President
Jungle Creatures, Inc.
http://www.junglecreatures.com/
Email: su*****@junglec reatures.com/
Nov 16 '05 #8
Any decompiler can't produce real same code of produced TLBIMP utility -
Try this - open interop assembly in the ildasm and see the attributes of
some methods of some COM interface - you'll see <internalcall > attribute -
it means that this method will execute thru .Net VM.
This attribute - is internal for .net framework attribute that you can't
atach to source, unfortunately :(
I've experimented with the Text Object Model (TOM) but have no good results
with using decompiled from tom.dll produced by tlbimp.

--
Best regards,
Victor Victorov
Spices.Net - class browser, decompiler, obfuscator, modeler for your .Net
apps.
9Rays.Net

Nov 16 '05 #9


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #10

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

Similar topics

1
336
by: Tom | last post by:
I have a question.. I am using remoting but on my client side I chose to use an interface. As a result I was wondering if its still possible to place the configuration details into a xml config file ? I have not seen any examples of this does anyone know how I can do this ? All I've seen are example such as below where an interface calling the server as such. but I would like to not use this and instead call the config file as its easily...
4
2437
by: Sunny | last post by:
Hi, As ATL/C++ are not my strongest field :), I'd like to ask for a little help here. Problem: I'm using mshtml to parse web pages. In the thread "Want to use msHTML.HTMLDocumentClass" as response to my question Hasani was so kind to point me that link (possible line wraps): http://support.microsoft.com/default.aspx? scid=http://support.microsoft.com:80/support/kb/articles/Q266/3/43.asp&N oWebContent=1
22
3494
by: amygdala | last post by:
Hi, I'm trying to grasp OOP to build an interface using class objects that lets me access database tables easily. You have probably seen this before, or maybe even built it yourself at some point in time. I have studied some examples I found on the internet, and am now trying to build my own from scratch. I have made a default table class (DB_Table), a default validation class (Validator) which is an object inside DB_Table and my...
1
1420
by: ashugoeln | last post by:
i want to information about the follwing how i can connect the c\c++(front end) with oracle(backend).pleae send me the whole information as well as coding as soon as possible thank u
1
1711
by: flohack | last post by:
Dear all, I am developing a C# application with a bunch of external calculation DLLs which are also used in a normal C++ project. So far everything works. If we change now some things in the unmanaged interface (structures, parameters, etc), a developer has to review the c# code and match the changes. this can be error-prone, especially if it does not happen simultaneously. Now the question, we would need something which parses a...
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8378
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8577
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8653
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2786
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.