Solved

Interactive Windows Service

Posted on 2003-11-20
3
666 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
ID: 9789742
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
ID: 9792237
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
ID: 9810628
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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