I have a windows service which I'm trying to write control code for. What I want is to put an icon in the system tray, and have a context menu on the icon. Then, when the user selects a menu item, either a form is shown, or some action is taken, depending on the menu item selected. I have a problem, and a couple of questions.
My problem is that I can't seem to get any events handled from the NotifyIcon. In the OnStart method, I create a NotifyIcon, and add a onclick handler. In the click handler, I add a simple MessageBox.Show("click"). I compile the service, add it with InstallUtil, and set the "Allow Service to Interact with Desktop" option in the control panel. I start it up, and the NotifyIcon appears correctly, but I can't get anything in the event handler to run. I've tried a number of variations, all with no luck. I've searched all over the net, and found people with this same problem, but no solutions. What am I doing wrong? My questions are related to managing the service. I want to have a fairly complex form to manage the service, which is started from the context menu. Should I put this form in a completely different assembly then the service, and/or call it from a different thread? What is the best practice of writing Windows services, and the UI that controls them? If anyone has an example project doing I'm working on, that would be very helpful. Thanks, Erick You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.