Shell_NotifyIcon from a service?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Service handles the EventWritten event on an event log. Service is set to
run as LocalSystem and interact with desktop. In the event handler, I create
a form (but don't show it), and then call the native Shell_NotifyIcon using
the form's handle and icon to display a balloon tip. The form will handle
the UserClicked message and display itself if the user clicks the balloon
tip. However, I have not yet successfully gotten the balloon tip to appear
(on Win 2K SP4). Any suggestions?

Thanks!
 
I believe owner for the tooltip is the form which is hidden thats why its not
diplaying the tooltip. I would recommend you to create irregular form with
overriden paint event displaying only the ToolTip like surface.

Instantiate though hide it while subscribing to interested event, when event
fires, show the form, display message, and after 1 or 2 second hide it again.
 
I don't think we're talking about quite the same thing here. The balloon tip
is associated with the NotifyIcon in the "tray". The only "association" with
the form is that the form handles the Windows message generated when the user
clicks on the balloon tip by showing itself. Think along the lines of the
network connection balloon tip on XP when your connection state changes.
When the user clicks the balloon tip, the adapter's properties form appears.
 
Hi Siliverz,

As for your service application, have you correctly displayed a normal form
to interact with the logon user? Based on experience, displaying UI in
NTSErvice will cause problem on multi-user server, it only display in the
default desktop even if we turn on the "allow service to interact with
desktop".
If you can display the form correctly, then have you tried just displaying
a notifyIcon at the taskbar to see whether it works?

In addition, there're some former threads discussing on the similiar
problem on displaying UI in NT Service. And someone also suggest that we
separate the service work from the UI. For example, create two separate
application , one is desktop winform app and another NtService app , the
desktop can communicate with the service via remoting or other outbound
means and winform app can also display well at each user's desktop.

http://groups.google.co.jp/groups?hl=zh-CN&lr=&frame=right&th=f56e0a2f3e0a56
c4&seekm=uxOD8B8ODHA.2316%40TK2MSFTNGP11.phx.gbl#link8

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top