Solved

Interactive Windows Service

Posted on 2003-11-20
3
664 Views
Last Modified: 2007-12-19
Here is the deal, I need an interactive Windows Webservice.  I had the application running as just an app but I would like to run it as a Windows Service with the same functionality but just starting with the Local System.  I found the setting for "Allow service to interact with desktop." and I have that checked.

Here is what is happening...I have a windows form that does all the work and I want it to be a "NotifyIcon" down in the task bar when a user is logged in.  When the user double clicks on this icon, a form is shown and they can change certain asspects of the service and how it works.

I have it all put together and it was working fine as an application but now, I can not really interact with the form.  When I double click on the NotifyIcon, nothing happens.  I tried debuging it and it doesn't look like the even is ever getting raised or something so nothing ever happens.

Any ideas or example solutions would be greatly appreciated and rewarded.

Thanks,
Eric
0
Comment
Question by:RealMrTea
3 Comments
 
LVL 4

Assisted Solution

by:NetPointer
NetPointer earned 100 total points
Comment Utility
if u download "Download 101 Code Samples for Visual Basic .NET 2003" from

http://msdn.microsoft.com/vbasic/downloads/samples/default.aspx

you will find following in it.

VB.NET - Windows Forms -  How-To System Tray Icon
VB.NET - Framework - How-To Service Manager

I suggest you dont mix both the code, but make two seperate app. one to configure service and other the actual service. and when u configure your service thru the application, you restart your service from that application (code is in above example.)

regarding debugging, i dont see there should be any problem. can u tell any specific signs?

regards,
NetPointer
0
 
LVL 1

Accepted Solution

by:
RocketMan801 earned 400 total points
Comment Utility
i thik that a good solution would be to split your APP in 2 parts:

A - the "core" of the aplication, i mean, the real funcionality of the APP running as a service as you have done, and of course becouse it is  a service, starting after the user logs into the machine

B - The "config form" of your app, running as a normal app, that starts when the user logs on becouse of  a key in the registry, or "start menu" or what ever you want, that, (and here is the important part) interacts with your service using the ServiceController class. Nothe that you dont have to inherit that class in a new one, just use it, calling the method "ExecuteCommand()" to send commands to the service, the service will raise the "OnCustomCommand()" method, there you can writte the result of the ausers interacion.
0
 
LVL 7

Author Comment

by:RealMrTea
Comment Utility
Thanks to the both of you for providing intresting and helpful answers.  I am going to split the points since you had simular answers.  Most of the points go to RocketMan because what I really needed was the ExecuteCommand and OnCustomCommand methods.  If anyone else is doing something simular, this is what I would recomend trying.

Thanks again,
Eric
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now