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

calling methods of components running in windows service

I have written one Widows Service in ATL, having a ATL component running.
Now it is very easy to create the VC client by calling CoCreateINstanceEx to
create the component running in the service and giving the appropriate
machine where the service runs..
How shud I got about doing the same thing if the client is written in C#..
I tried using Remoting and ServiceController, but all in vein...
Firstly I wud like to know if it is possible to write such a client to ATL
service using C#.And if yes how shud I go abt it..

thanks

Nov 16 '05 #1
4 5723
Hi Jasleen,

Create an interop assembly for the ATL service by using tlbimp.exe and
reference this assembly from your C# project.
This assembly will contain classes corresponding to the creatable coclasses
registered by the ATL service. You can instantiate them from managed code
just as any other classes.

You might want to refer to the MSDN COM Interop samples for better
understanding how COM servers are accessed by .NET clients.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Jasleen" <Ja*****@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
I have written one Widows Service in ATL, having a ATL component running.
Now it is very easy to create the VC client by calling CoCreateINstanceEx
to
create the component running in the service and giving the appropriate
machine where the service runs..
How shud I got about doing the same thing if the client is written in C#..
I tried using Remoting and ServiceController, but all in vein...
Firstly I wud like to know if it is possible to write such a client to ATL
service using C#.And if yes how shud I go abt it..

thanks


Nov 16 '05 #2
I did that but how can I specify the machine name and other security
attributes while instantiating the server object.
I mean how do I tell on which machine the server exists...
For example following code will be there if I use the imported reference
ServerClass sc = new ServerClass();
But in the above instantiation I am unable to specify the machine name and
logon details etc..as u can do in CoCreateInstanceEx.
I hope I am able to put forth my problem..

"Dmitriy Lapshin [C# / .NET MVP]" wrote:
Hi Jasleen,

Create an interop assembly for the ATL service by using tlbimp.exe and
reference this assembly from your C# project.
This assembly will contain classes corresponding to the creatable coclasses
registered by the ATL service. You can instantiate them from managed code
just as any other classes.

You might want to refer to the MSDN COM Interop samples for better
understanding how COM servers are accessed by .NET clients.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Jasleen" <Ja*****@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
I have written one Widows Service in ATL, having a ATL component running.
Now it is very easy to create the VC client by calling CoCreateINstanceEx
to
create the component running in the service and giving the appropriate
machine where the service runs..
How shud I got about doing the same thing if the client is written in C#..
I tried using Remoting and ServiceController, but all in vein...
Firstly I wud like to know if it is possible to write such a client to ATL
service using C#.And if yes how shud I go abt it..

thanks


Nov 16 '05 #3
Jasleen,

Here's an MSDN example for Media Services:

Type tServerType;
WMSServer RemoteServer;

// Retrieve the type information from the Windows
// Media server running on the remote machine.
tServerType = Type.GetTypeFromProgID("WMSServer.Server",
"remote_computer_name");

// Create an instance of the remote server object locally.
RemoteServer = (WMSServer)Activator.CreateInstance(tServerType);

Of course you should still have the interop library in place for the type
cast to work.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Jasleen" <Ja*****@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
I did that but how can I specify the machine name and other security
attributes while instantiating the server object.
I mean how do I tell on which machine the server exists...
For example following code will be there if I use the imported reference
ServerClass sc = new ServerClass();
But in the above instantiation I am unable to specify the machine name and
logon details etc..as u can do in CoCreateInstanceEx.
I hope I am able to put forth my problem..

"Dmitriy Lapshin [C# / .NET MVP]" wrote:
Hi Jasleen,

Create an interop assembly for the ATL service by using tlbimp.exe and
reference this assembly from your C# project.
This assembly will contain classes corresponding to the creatable
coclasses
registered by the ATL service. You can instantiate them from managed code
just as any other classes.

You might want to refer to the MSDN COM Interop samples for better
understanding how COM servers are accessed by .NET clients.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Jasleen" <Ja*****@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
>I have written one Widows Service in ATL, having a ATL component
>running.
> Now it is very easy to create the VC client by calling
> CoCreateINstanceEx
> to
> create the component running in the service and giving the appropriate
> machine where the service runs..
> How shud I got about doing the same thing if the client is written in
> C#..
> I tried using Remoting and ServiceController, but all in vein...
> Firstly I wud like to know if it is possible to write such a client to
> ATL
> service using C#.And if yes how shud I go abt it..
>
> thanks
>



Nov 16 '05 #4
Thanks a lot....
I cud achieve my objective....
"Dmitriy Lapshin [C# / .NET MVP]" wrote:
Jasleen,

Here's an MSDN example for Media Services:

Type tServerType;
WMSServer RemoteServer;

// Retrieve the type information from the Windows
// Media server running on the remote machine.
tServerType = Type.GetTypeFromProgID("WMSServer.Server",
"remote_computer_name");

// Create an instance of the remote server object locally.
RemoteServer = (WMSServer)Activator.CreateInstance(tServerType);

Of course you should still have the interop library in place for the type
cast to work.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Jasleen" <Ja*****@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
I did that but how can I specify the machine name and other security
attributes while instantiating the server object.
I mean how do I tell on which machine the server exists...
For example following code will be there if I use the imported reference
ServerClass sc = new ServerClass();
But in the above instantiation I am unable to specify the machine name and
logon details etc..as u can do in CoCreateInstanceEx.
I hope I am able to put forth my problem..

"Dmitriy Lapshin [C# / .NET MVP]" wrote:
Hi Jasleen,

Create an interop assembly for the ATL service by using tlbimp.exe and
reference this assembly from your C# project.
This assembly will contain classes corresponding to the creatable
coclasses
registered by the ATL service. You can instantiate them from managed code
just as any other classes.

You might want to refer to the MSDN COM Interop samples for better
understanding how COM servers are accessed by .NET clients.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Jasleen" <Ja*****@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
>I have written one Widows Service in ATL, having a ATL component
>running.
> Now it is very easy to create the VC client by calling
> CoCreateINstanceEx
> to
> create the component running in the service and giving the appropriate
> machine where the service runs..
> How shud I got about doing the same thing if the client is written in
> C#..
> I tried using Remoting and ServiceController, but all in vein...
> Firstly I wud like to know if it is possible to write such a client to
> ATL
> service using C#.And if yes how shud I go abt it..
>
> thanks
>


Nov 16 '05 #5

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

Similar topics

0
by: Eych | last post by:
is it possible to include a working web service (.asmx or .dll) in an application that would run on a PC that is not connected to the internet and is standalone (with no IIS running either)? I don't...
3
by: belgiozen | last post by:
Hi, I have a working windows service,it is looking for files on the disk and when some of the files are cupdated it calls an executable. But it takes a lot of time(about 10 minutes) to run the...
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
0
by: Fabio Hemylio | last post by:
I have built a XML Web Services that needs to call a COM component registered im Component Services. When calling the methods from XML Web Service, that in turns calls the methods from COM+...
6
by: ahmad.humyn | last post by:
I want to call a hidden form. My code goes something like in which the main calls form1. form1 has a button which creates & calls form2 and hides itself. Now I have a button in form2 which if...
3
by: Michael Maes | last post by:
Hi, We have a windows service passing objects to a client application by remoting. The windows service is started and running successfully. * When the client app is running on the same...
3
by: =?Utf-8?B?bGVvMg==?= | last post by:
Hi All, I have a question which might be a beginner's question. I have a webservice whose webmethod has to call a window's service and get back the results. What is the best way to implement...
0
by: BornTOCode | last post by:
Hello, I am attempting to call a (Delphi) win32 DLL from a Delphi.Net webservice. I am using a slightly modified version of the hello world webservice that comes with Delphi 2006. The DLL...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.