K
kieran.j.lee
Hi,
I have hunted round the web and managed to put together some code which
displays a balloon tip for a notification icon in the system tray when
I am running a windows service. This times out after about 10 seconds
if I move the mouse around the screen which is pretty much okay, but if
I don't do anything the balloon just stays showing for a long time. Is
there a method to kill this balloon tip without killing the whole icon
(a method I have temporarily employed is making the icon invisible and
then making it visible again the next time I want to display a balloon
tip). Ideally, I would like the icon to remain so users are able to
see the service is running in the background.
Also, does anyone know how to power up the monitor when Power
Management has switched the monitor off from within code? I have tried
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MONITORPOWER = 0xF170;
public const int MONITOR_ON = 1;
public const int MONITOR_OFF = 2;
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SendMessage(IntPtr hWnd, UInt32 Msg, int wParam, int
lParam);
[DllImport("user32.dll")]
static extern IntPtr GetDesktopWindow();
SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_MONITORPOWER, 1);
without success.
Regards,
Kieran Lee
I have hunted round the web and managed to put together some code which
displays a balloon tip for a notification icon in the system tray when
I am running a windows service. This times out after about 10 seconds
if I move the mouse around the screen which is pretty much okay, but if
I don't do anything the balloon just stays showing for a long time. Is
there a method to kill this balloon tip without killing the whole icon
(a method I have temporarily employed is making the icon invisible and
then making it visible again the next time I want to display a balloon
tip). Ideally, I would like the icon to remain so users are able to
see the service is running in the background.
Also, does anyone know how to power up the monitor when Power
Management has switched the monitor off from within code? I have tried
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MONITORPOWER = 0xF170;
public const int MONITOR_ON = 1;
public const int MONITOR_OFF = 2;
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SendMessage(IntPtr hWnd, UInt32 Msg, int wParam, int
lParam);
[DllImport("user32.dll")]
static extern IntPtr GetDesktopWindow();
SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_MONITORPOWER, 1);
without success.
Regards,
Kieran Lee