Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Interactive Windows Service

Posted on 2003-11-20
3
Medium Priority
?
671 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 300 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 1200 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Screencast - Getting to Know the Pipeline

927 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