473,396 Members | 1,989 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,396 software developers and data experts.

COM Servers

How do you write a COM server in C# VS 2003? I can't believe it but I can't
even find the words COM in the help for VS related to COM servers. Did
Microsoft Rename it again or can VS C# not handle the task? Why is there
nothing available for me to read?

Thanks,

glenn
Nov 17 '05 #1
12 1640
> How do you write a COM server in C# VS 2003? I can't believe it but I can't
even find the words COM in the help for VS related to COM servers. Did
Microsoft Rename it again or can VS C# not handle the task? Why is there
nothing available for me to read?

Because C# is a .NET langauge, there isn't direct support for building
COM servers, you should be thinking .NET assemblies. If you aren't
going to stick to .NET, VS C++ still includes the ATL framework, which
is probably the most comprehensive way to put together COM servers.
Nov 17 '05 #2
So to get this straight. If I want to write a COM server that would allow
someone writing another program in another language, I can not use C#? Boy
does this change my opinion of .NET rather dramatically....

Thanks,

glenn
"Jason" <ja***@nospam.com> wrote in message
news:ua*************@TK2MSFTNGP09.phx.gbl...
How do you write a COM server in C# VS 2003? I can't believe it but I can't even find the words COM in the help for VS related to COM servers. Did
Microsoft Rename it again or can VS C# not handle the task? Why is there nothing available for me to read?

Because C# is a .NET langauge, there isn't direct support for building
COM servers, you should be thinking .NET assemblies. If you aren't
going to stick to .NET, VS C++ still includes the ATL framework, which
is probably the most comprehensive way to put together COM servers.

Nov 17 '05 #3

"Jason" <ja***@nospam.com> wrote in message
news:ua*************@TK2MSFTNGP09.phx.gbl...
How do you write a COM server in C# VS 2003? I can't believe it but I
can't
even find the words COM in the help for VS related to COM servers. Did
Microsoft Rename it again or can VS C# not handle the task? Why is there
nothing available for me to read?

Because C# is a .NET langauge, there isn't direct support for building COM
servers, you should be thinking .NET assemblies. If you aren't going to
stick to .NET, VS C++ still includes the ATL framework, which is probably
the most comprehensive way to put together COM servers.


C# is a programming language, and as such doesn't support COM directly (nor
does C++), but this is handled by the Framework and the CLR. That means that
basically each managed class can be exposed as a COM class, sure you have to
respect some design guidelines when exposing to native COM clients, but it's
perfectly possible and fully supported and used extensively by the framework
and VS.

To OP, check the MSDN library -
http://msdn.microsoft.com/library/de...tcomserver.asp

and this:
http://msdn.microsoft.com/library/de...tcomserver.asp
and this:

http://msdn.microsoft.com/library/de...tcomserver.asp

COM servers can be implemented by deriving from ServicedComponent and can be
exposed to COM clients and .NET clients.
Check:
http://msdn.microsoft.com/library/de...ponents.aspfor details:Willy.

Nov 17 '05 #4
Yes it's true there is no direct support for building COM components, but
there is a rich interop layer in .NET which allows communication in both
directions between .NET and COM components (albeit with a few limitations
and perhaps performance overhead compared with pure COM).
Some links here covering basic principles:
http://msdn.microsoft.com/vstudio/us...p/default.aspx

There is also COM+/EnterpriseServices, which provides another attractive
alternative for integrating with COM (especially looking forward to
"Longhorn/Indigo").
Take a look at System.EnterpriseServices namespace in the .NET framework.

As for terminology - roughly speaking COM+MTS became COM+ which became
component-services/enterprise-services in today's terminology.

Nov 17 '05 #5

"glenn" <gh******@softeksoftware.com> wrote in message
news:OF**************@TK2MSFTNGP12.phx.gbl...
So to get this straight. If I want to write a COM server that would allow
someone writing another program in another language, I can not use C#?
Boy
does this change my opinion of .NET rather dramatically....

Thanks,

glenn


Sure you can, .NET makes it easier than before to write COM components, see
my other reply.
And if you are looking for some real good readings consider these (in order
of my personal preferences):

http://www.amazon.com/exec/obidos/AS...344360-6822569

http://www.amazon.com/exec/obidos/tg...=UTF8&v=glance

http://www.amazon.com/exec/obidos/tg...=UTF8&v=glance

Willy.
Nov 17 '05 #6
Thank you very much. Jason had me a little worried for a second there...

glenn
"glenn" <gh******@softeksoftware.com> wrote in message
news:eX**************@TK2MSFTNGP10.phx.gbl...
How do you write a COM server in C# VS 2003? I can't believe it but I can't even find the words COM in the help for VS related to COM servers. Did
Microsoft Rename it again or can VS C# not handle the task? Why is there
nothing available for me to read?

Thanks,

glenn

Nov 17 '05 #7
How much of a performance hit? I am use to writing my COM servers in
Borland Delphi. Are my components written in C# going to be drastically
slower?

Thanks,

glenn
"richlm" <ri****@nospam.nospam> wrote in message
news:ej**************@TK2MSFTNGP09.phx.gbl...
Yes it's true there is no direct support for building COM components, but
there is a rich interop layer in .NET which allows communication in both
directions between .NET and COM components (albeit with a few limitations
and perhaps performance overhead compared with pure COM).
Some links here covering basic principles:
http://msdn.microsoft.com/vstudio/us...p/default.aspx

There is also COM+/EnterpriseServices, which provides another attractive
alternative for integrating with COM (especially looking forward to
"Longhorn/Indigo").
Take a look at System.EnterpriseServices namespace in the .NET framework.

As for terminology - roughly speaking COM+MTS became COM+ which became
component-services/enterprise-services in today's terminology.

Nov 17 '05 #8
> How much of a performance hit? I am use to writing my COM servers in
Borland Delphi. Are my components written in C# going to be drastically
slower?


Here are my thoughts:
1 - You could continue using Delphi to write your COMs
2 - C# + COM => Interop call. This can be very expensive if there are
many many calls!

--

----------------------------------------------

http://michael.moreno.free.fr/

Nov 17 '05 #9
Problem is I would eventually like to get to a single programming language
for this project. I don't want to have to continue to program in 2
languages and as it stands its starting to look like Delphi might be the
best choice. It seems to generate much faster code, has a much better IDE
with lots more components, manages code a lot better, and the data access
elements of the language are far better designed and thought out than it
appears have been done in VS2003. One reason I'm holding off is I want to
see if any of these items have been addressed in VS2005 but I have no idea
how long that wait is going to be.

And it also sounds like the COM elements of it are going to be the same
which means any interfaces I write that I need to share with other companies
are going to run much slower than if written in Delphi.

This is very disappointing...

glenn
"Michael Moreno" <ab*@abc.abc> wrote in message
news:mn***********************@abc.abc...
How much of a performance hit? I am use to writing my COM servers in
Borland Delphi. Are my components written in C# going to be drastically
slower?


Here are my thoughts:
1 - You could continue using Delphi to write your COMs
2 - C# + COM => Interop call. This can be very expensive if there are
many many calls!

--

----------------------------------------------

http://michael.moreno.free.fr/

Nov 17 '05 #10

"glenn" <gh******@softeksoftware.com> wrote in message
news:OV**************@TK2MSFTNGP15.phx.gbl...
Willy,

I purchased the first book you recommended in Digital form and I have to
say, while he does go through quite a bit of explanation I have yet to
find
a single example in the book that actually works. And the things that he
seems to get wrong, he offers no explanations on. I downloaded the source
code for the book from SAM's website and its most in VB and the examples
given in the book are not even in the download. Only the major examples.

So while I am learning, I would not recommend this particular book to
anyone. It is very frustrating to be trying to figure this stuff out, pay
almost $50 bucks for a book and have it do nothing but frustrate you even
more due to the lack of attention to detail...

Do you know if any of the other books you have listed have working
examples
or are they pretty much the same as this book?

Thanks,

glenn


I suppose you are talking about Adam Nathan's .NET and COM: The Complete
Interoperability Guide, right?
I didn't know that the code samples were available for download, after all
this is a text book not a work book.
I have the in-print edition, I don't say it's perfect, but I've only met a
few inaccuracies, which IMO is quite normal when you consider it covers, in
1600 pages, everything you possibly should know about the subject and that
it was written based on a Beta version v1.0 .
Do you mind to share were he got wrong (just the page numbers of a few
samples)?

Another good reading is COM and .NET Interoperability by Andrew Troelsen
http://www.apress.com/book/supplemen...bID=81&sID=371

Willy.

Nov 17 '05 #11
Well, possibly he didn't get it wrong and its based on the fact that things
have changed, however, you can pretty much choose any sample code up to
chapter 8 and it won't compile as is printed. The very first example uses
the speech engine from microsoft but the parameters he's passing in are
invalid and won't compile so I had to just use another COM server for the
example.

I'm currently trying to compile and use the COM Server section listed as the
first example of chapter 8. He has me generating strong names that I've
never done before but the code he has me adding to the application for the
Strong name won't compile and says its a duplicate name or something.

But as I stated, perhaps the problem is more that he wrote the book long
before 2003 was out and things have changed substantially causing small
problems with each example. But for a frustrated programmer trying to learn
this stuff its only serving to frustrate me more...

Thanks,

glenn
Nov 17 '05 #12
inline

Willy.

"glenn" <gh******@softeksoftware.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
Well, possibly he didn't get it wrong and its based on the fact that
things
have changed, however, you can pretty much choose any sample code up to
chapter 8 and it won't compile as is printed. The very first example uses
the speech engine from microsoft but the parameters he's passing in are
invalid and won't compile so I had to just use another COM server for the
example.

I'm currently trying to compile and use the COM Server section listed as
the
first example of chapter 8. He has me generating strong names that I've
never done before but the code he has me adding to the application for the
Strong name won't compile and says its a duplicate name or something.
This is the same sample code you posted, I compiled it, including the key
generation sn -k Keyfile.snk and it ran without a problem using a simple COM
client.
So, I guess the problem is yours.

But as I stated, perhaps the problem is more that he wrote the book long
before 2003 was out and things have changed substantially causing small
problems with each example.
I don't think so, see above. Note that Adam Nathan is one of the designers
of the COM interop stuff in the CLR.

But for a frustrated programmer trying to learn this stuff its only serving to frustrate me more...

Thanks,

glenn

Nov 17 '05 #13

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

Similar topics

1
by: Meghna | last post by:
Hi, I was wondering if some one would be able to help me with this. I am trying to share a session across two servers and I seem to be experiencing some problems. I was wondering if anybody has...
10
by: Captain Ranger McCoy | last post by:
Hello! Suppose I have ten servers at ten ips: x.x.x.1 x.x.x.2 x.x.x.3 x.x.x.4 and so on Each server hosts 100+ photo galleries, all under a single domain name,
2
by: D Barry | last post by:
Greetings: I am trying to conceive what risks might be created by running multiple SQL servers within a domain under a single domain account, as opposed to 1) running under the local service...
5
by: Oliver Braun | last post by:
I know this is a very common issue and I found a lot of hints on this topic in www but I did not find a very good solution for this task. Most of the solutions use SQLDMO to list all sql servers...
3
by: Ben Holness | last post by:
Hi all, I have a php/mysql website where people can upload their own graphics for the buttons and background of pages on the website. This used to run on one server, but I have now been asked...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
13
by: Samir Chouaieb | last post by:
Hello, I am trying to find a solution to a login mechanism for different domains on different servers with PHP5. I have one main domain with the user data and several other domains that need...
1
vvsvinu
by: vvsvinu | last post by:
Iam a sys admin in a firm and iam asked to give a configuration list of a server profile. As there are a lot of new servers now a days and also from the net i got some information still iam confused...
2
vvsvinu
by: vvsvinu | last post by:
Iam a sys admin in a firm and iam asked to give a configuration list of a server profile. As there are a lot of new servers now a days and also from the net i got some information still iam confused...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.