Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

C# and COM

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe - 17 Mar 2008 15:15 GMT
Hello,
I have to create an interface to allow another application to communicate
with ours. I'm thinking of adding a COM interface into our exe to allow this
but I'm not sure this is the best way to go.

The other application needs to be able to launch ours, send it some data and
call some configuration methods.

Any suggestions?

Thanks,
Joe
Peter Ritchie [C# MVP] - 17 Mar 2008 19:30 GMT
If your other application is not written in a managed language (like C#) this
is likely the only option.

If your other application is written in a manage language (like C) I would
recommend simply using class libraries and reference them directly and not
use COM directly.
Signature

Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#

> Hello,
> I have to create an interface to allow another application to communicate
[quoted text clipped - 8 lines]
> Thanks,
> Joe
Jialiang Ge [MSFT] - 18 Mar 2008 03:42 GMT
Hello Joe,

As Peter suggested, if the .NET assembly will be consumed by native
executables, we can register the .NET assembly as COM server.

Regarding how to register the .NET assembly as COM server, please refer to
the following articles:

MSDN: COM Interop Part2: C# Server Tutorial
http://msdn2.microsoft.com/en-us/library/aa645738(VS.71).aspx

codeproject: Calling Managed .NET C# COM Objects from Unmanaged C++ Code
http://www.codeproject.com/KB/cs/ManagedCOM.aspx

I hesitated to recommend that codeproject article because it has an error
in its sample code. The interface IMyDotNetInterface and the class
MyDotNetClass should be declared as public. However, this article
demonstrates how to use regasm
(http://msdn2.microsoft.com/en-us/library/tzat5yw6(VS.71).aspx) to generate
and register tlb (type library).

If you have any other questions or concerns, please feel free to let me
know.

Regards,
Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Joe - 18 Mar 2008 19:50 GMT
Hello,

Currently the application that needs to interact with ours is a .NET
application written in C#. We want the application to be able to launch our
application out of proc. If they just reference our application using a
standard .NET reference then they can call all our applications methods but
it's within their memory space. We don't really want this.

Is this our only option when it comes to .NET calling .NET?

Thanks,
Joe

> Hello Joe,
>
[quoted text clipped - 50 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Christopher Van Kirk - 19 Mar 2008 00:18 GMT
You could consider wrapping the COM with a C# wrapper then remoting that
wrapper from a service. The code running the COM would then be out of
process with your application, but you would have a fair amount of calling
overhead and complexity added in. Of course on the upside you could have
that service running anywhere in the network.

> Hello,
>
[quoted text clipped - 67 lines]
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.

Signature

Posted via a free Usenet account from http://www.teranews.com

Jialiang Ge [MSFT] - 19 Mar 2008 08:32 GMT
Hello Joe and Christopher,

I agree with Christopher's idea. .NET Remoting can help us do the
out-of-proc call from .NET to .NET. Another solution is to use DCOM.

See how to write a DCOM server in C#:
http://blogs.msdn.com/adioltean/archive/2004/06/18/159479.aspx

and how to consume the DCOM server in a C# client:
http://www.thescripts.com/forum/thread49121.html

Regards,
Jialiang Ge  (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
Jialiang Ge [MSFT] - 21 Mar 2008 11:00 GMT
Hi Joe,

I am writing to check the status of the issue. Would you mind letting me
know the result of the suggestions? If you need further assistance, feel
free to let me know. I will be more than happy to be of assistance.

Have a great day!

Regards,
Jialiang Ge  (jialge@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
Willy Denoyette [MVP] - 19 Mar 2008 11:36 GMT
> Hello,
> I have to create an interface to allow another application to communicate
[quoted text clipped - 8 lines]
> Thanks,
> Joe

What kind of application is this? Interactive or not?
If the other applications are .NET only there is no need to expose this
through COM, this is only required when you want to expose functionality to
non .NET application.

Willy.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.