Link to home
Start Free TrialLog in
Avatar of Razzie_
Razzie_

asked on

Communicating with a Windows Service

Hi all,

I have a Windows Service that transfers data from one database to another in an x couple of minutes. Now I want to have a user interface with which I can control my service.

For example, I use want to use a progressbar in my UI that displays if the service is done transferring the data or not. I can't just have the UI application call something like 'getTransferProgress()', and have the service return a value to my UI application. Is this possible? And is it possible to set or get properties of a service?

I haven't found _anything_ about this after 2 days of searching. Anyone got a solution? It would be most appreciated!

Razzie
Avatar of AlexFM
AlexFM

About getTransferProgress or something else - it's up to service writer to expose service control codes which may be used to get/set variuos information.
Avatar of Razzie_

ASKER

The problem with these links is that they cover just what I already understand, and that is doing things which are defined in the ServiceController class (stopping, pausing, starting, etc).


'About getTransferProgress or something else - it's up to service writer to expose service control codes which may be used to get/set variuos information'


THIS is exactly the thing I have difficulties with. I do not know how to write service control codes to get/set various information. For example if I write this method in my service:

public int getProgress()
{ return somevalue; }

and, in my UI app:

private System.ServiceProcess.ServiceController sc = new ServiceController("myService");
progressValue = sc.getProgress();

it will return an error since the getProgress() method is not a member of the ServiceController class! So obviously, I would like to know how to get this work. I tried using the ExecuteCommand method, but this method is void and cannot return a value...
ASKER CERTIFIED SOLUTION
Avatar of testn
testn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Razzie_

ASKER

Thanks testn, that was what I was looking for.