Click here to Skip to main content
15,884,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi masters,

I want to create a windows service that run in background automatically when system boot.
I can do it well, now I want to call a function in my service from my app when for example a button clicked. And that function returns something to my app from the running service.

I have looked on the Internet and found a few examples about creating a Windows Service, building installers, and registering the service; however, I cannot seem to find any documentation on how to interact with running services via a different application.

Now how do I do this?

Thanks.
Posted
Updated 18-Jun-13 21:14pm
v2

That's not the way a windows service works. A windows service is basically a program that runs silently (and UI-less) in the background to perform certain tasks. You can't interact with it (well, you might be able to, but it's not meant to work that way).

What you are thinking of is a web service that is hosted on a web server and provides you with data from a given data storage (typically a database).

What do you want to return to your app?

If it is some information about the local system, then why do you need a service for it when your program just as well can retrieve the information itself?

And if it is remote information you need to return, you will want to create a web service and host it remotely...

[EDIT] If I can give you a tip for future questions: Your keyboard has a CAPS button. Use it! Writing a text in all lower case is sloppy and disrespectful. At least capitalize the first letter in the sentence and "I" of course. [/EDIT]
 
Share this answer
 
v4
Comments
The_Leader 19-Jun-13 4:13am    
Thanks Johnny about the explanation. I want to return for example a File Stream. But my goal is use the service for encryption and decryption my data instead of using DLL, for more security and avoiding of dll decompiling.
 
Share this answer
 
Comments
Johnny J. 19-Jun-13 3:15am    
This is not what the OP wants. He said that he already knows this! Please reread the question!
The_Leader 19-Jun-13 4:03am    
tnx johnny.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900