473,738 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to send events to a Window Service

Hi

I have a window service written in C#. I have another application that
requires a lengthy process to be performed like taking backup. How can I
make this lengthy process be performed by window service in such a manner
that my application may invoke the process. Is there any way that I can call
some method written in window service apart from Start, Stop, Pause etc from
my application or firing some custom event to the window service to start
that operation. Its better if I could get some mechanism to call the
service's method as I also need to pass some arguments from my application
to the service that may not be easy to send using event based calls. Please
advice.

Regards

Usman
Oct 28 '05 #1
6 2504
You could use remoting todo this or with .NET2 you can use WCF.

Steve
"Usman" <us***@advcomm. net> wrote in message
news:eb******** *****@TK2MSFTNG P10.phx.gbl...
Hi

I have a window service written in C#. I have another application that
requires a lengthy process to be performed like taking backup. How can I
make this lengthy process be performed by window service in such a manner
that my application may invoke the process. Is there any way that I can
call
some method written in window service apart from Start, Stop, Pause etc
from
my application or firing some custom event to the window service to start
that operation. Its better if I could get some mechanism to call the
service's method as I also need to pass some arguments from my application
to the service that may not be easy to send using event based calls.
Please
advice.

Regards

Usman

Oct 28 '05 #2
ServiceControll er.ExecuteComma nd lets your app send a one-way integer value
to your Service, which gets it in an OnCustomCommand event. You'll have to
use something like the registry to indicate back to the app that you've
finished.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

"Usman" <us***@advcomm. net> wrote in message
news:eb******** *****@TK2MSFTNG P10.phx.gbl...
Hi

I have a window service written in C#. I have another application that
requires a lengthy process to be performed like taking backup. How can I
make this lengthy process be performed by window service in such a manner
that my application may invoke the process. Is there any way that I can
call
some method written in window service apart from Start, Stop, Pause etc
from
my application or firing some custom event to the window service to start
that operation. Its better if I could get some mechanism to call the
service's method as I also need to pass some arguments from my application
to the service that may not be easy to send using event based calls.
Please
advice.

Regards

Usman

Oct 28 '05 #3

Usman wrote:
Hi

I have a window service written in C#. I have another application that
requires a lengthy process to be performed like taking backup. How can I
make this lengthy process be performed by window service in such a manner
that my application may invoke the process. Is there any way that I can call
some method written in window service apart from Start, Stop, Pause etc from
my application or firing some custom event to the window service to start
that operation. Its better if I could get some mechanism to call the
service's method as I also need to pass some arguments from my application
to the service that may not be easy to send using event based calls. Please
advice.


You can use whatever IPC mechanism you like to send commands from a
user mode app to the service :
- COM
- socket
- Named Pipe
- Event / MMF
- .NET remoting
- etc...

Arnaud
MVP - VC

Oct 28 '05 #4
Hi

You mentioned COM as a possibility. Is there any mechanism through which I
could expose the methods of window service like a com does and call it using
the exact signature of that exposed method from my application including the
parameters. Also how can the .Net Remoting be usefull in this scenario, can
a .Net remoting service expose methods of its own or are you referring to
the Remotable objects.

Regards

Usman Jamil

<ad******@clu b-internet.fr> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.com...

Usman wrote:
Hi

I have a window service written in C#. I have another application that
requires a lengthy process to be performed like taking backup. How can I
make this lengthy process be performed by window service in such a manner that my application may invoke the process. Is there any way that I can call some method written in window service apart from Start, Stop, Pause etc from my application or firing some custom event to the window service to start that operation. Its better if I could get some mechanism to call the
service's method as I also need to pass some arguments from my application to the service that may not be easy to send using event based calls. Please advice.


You can use whatever IPC mechanism you like to send commands from a
user mode app to the service :
- COM
- socket
- Named Pipe
- Event / MMF
- .NET remoting
- etc...

Arnaud
MVP - VC

Oct 29 '05 #5

"Usman" <us***@advcomm. net> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
You mentioned COM as a possibility. Is there any mechanism through
which I
could expose the methods of window service like a com does and call it
using
the exact signature of that exposed method from my application
including the
parameters.
You cannot write a COM local server (exe) in .NET. The nearest
equivalent is to write a library assemly with public types and these
types will use some IPC (sockets or .NET remoting) to talk to the
equivalent types implemented in the service. The library assembly can
then be called via COM interop as an inproc server. (using the tlbexp
tool)
Also how can the .Net Remoting be usefull in this scenario, can
a .Net remoting service expose methods of its own or are you referring
to
the Remotable objects.


..NET remoting is an interprocess communication mechanism - it allows two
processes to talk with each other and it requires .NET in both the
client and server. In your case, the service provides the remote
objects. The client accesses these remote objects as if they are local
objects.

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Oct 29 '05 #6
Usman wrote:
Hi

You mentioned COM as a possibility. Is there any mechanism through
which I could expose the methods of window service like a com does
and call it using the exact signature of that exposed method from my
application including the parameters. Also how can the .Net Remoting
be usefull in this scenario, can a .Net remoting service expose
methods of its own or are you referring to the Remotable objects.


Both COM and .NET remoting (and Corba too) are mechanisms to expose an
object so that it can be called upon by external programs (even programs on
another machine). The idea is that the service exposes on such object that
can be manipulated by external programs (in your case, the user app). You
can expose whatever functionnality you want through this object. The ser app
will call methods on the object exactly as if it was a local object.

Arnaud
MVP - VC
Nov 5 '05 #7

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

Similar topics

10
32646
by: BadOmen | last post by:
I want my program to send a mouse click to the window at the current mouse position, how do I do that? Example: I have my mouse over a button in Word and then my program is sending the left mouse click and the button under the mouse is clicked. Yours, Jonas
17
467
by: Michael Fan | last post by:
I am a newbie for web servcie and want to write a web service which monitors the certain field in the database. Once it exceeds the certain value, web service will send out notification to web service consumer who will take action on it. Is it possible? If yes, how to implement? If possible, please provide me the link. Thanks lot.
7
2443
by: cider123 | last post by:
I'm coding a project using the following article as reference: http://www.codeproject.com/csharp/DynamicPluginManager.asp In this type of project, plugins are loaded dynamically into a Plugin Manager. Your main application then hooks into the Plugin Manager. What I'm trying to figure out is how to impliment some form of raising
6
11142
by: harvie wang | last post by:
Hi, How to send a message to every window(include child window), I use SendMessage ,but It can't do that. class frmA { public const int WM_test = 0x400 + 1; protected override void WndProc(ref Message m) {
3
1276
by: M. Simioni | last post by:
Hi, the scenario should be like this: I have a "Server" application, and a UserControl running on an asp.net page. The UserControl sends a SQL Query string via UDP to the Server (after some sort of authentication, etc etc) The Server Application executes the query on his local SQL2k server The Server Application gets the recordset returned by query execution Then the server application sends to the UserControl the recordset returned by...
1
1117
by: John | last post by:
Hi all, Ive created a new ASP.NET web app and am trying to learn C#/VS 2005. My first hurdle is that I can't find anywhere in the IDE where I can associate a control with it's events. I need to cater for certain events of ceratin controls but can't find where I'm supposed to do this like in VB.NET. Any ideas? Regards
6
251
by: Usman | last post by:
Hi I have a window service written in C#. I have another application that requires a lengthy process to be performed like taking backup. How can I make this lengthy process be performed by window service in such a manner that my application may invoke the process. Is there any way that I can call some method written in window service apart from Start, Stop, Pause etc from my application or firing some custom event to the window service...
7
13977
by: Ahmad Jalil Qarshi | last post by:
Hi! I want to develop two applications one a Windows Service and the other a GUI based application. I want some sort of communication between Service and GUI. I have decided to use Remoting for this purpose. For this I registered an object on Service side for Remoting purposes. Remote Object exposes a function named ReloadFiles() that should internally send a message to service class to Reload some files. Now I don't know how to send...
2
6362
by: yevron2 | last post by:
Hello, I am trying to get clipboard events using SetClipboardViewer api. It works in a windows form when i override the function: protected override void WndProc(ref System.Windows.Forms.Message m) that belongs to the base class System.Windows.Forms. The problem is that i want to do it in a windows service...
0
8968
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
8787
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
9473
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...
0
9334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6750
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
6053
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.