Service, tray icon and system log off

  • Thread starter Thread starter Carlos Natal
  • Start date Start date
C

Carlos Natal

Hi all,

While creating a windows service using .NET and C# I had to call
myForm.ShowDialog() from within a thread I have created inside the OnStart()
method.

When this window is closed, my thread terminated and the tray icon displayed
is removed. The service runs ok while the user is logged on the system.
When the user logs off, all windows are closed (including the one from my
service - I used 'Service Interacts with Desktop') but the system simples
does not log off, i.e., I have to select the log off menu again.

This problem does not occour when I do not show my form.

Any ideas? Has anyone created a service that displays an icon and tried
logging off.

Thanks,
Carlos
 
* "Carlos Natal said:
While creating a windows service using .NET and C# I had to call
myForm.ShowDialog() from within a thread I have created inside the OnStart()
method.

Avoid providing UIs in a service application directly. Instead, create
a client application that communicates with the service and provides the
UI.
 
Hi,

I have managed to solve this problem. I use Application.Run(myform) instead
of myform.ShowDialog().

Now I have another problem related to the tray icon: when the user logs off
and back on I can't manage to restore the icon.

Any ideas?
Thanks
 
Back
Top