Solved

Interactive Windows Service

Posted on 2003-11-20
3
668 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 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