ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
Subject:   Hidden tooltips for taskbar/icontray
Date:   2007-05-08 12:34:45
From:   kangfucius
Response to: Hidden tooltips for taskbar/icontray

Here's a version in C#:

// Program: TopmostToolTips
// Bring tooltip windows to the front (top most) - workaround for the Windows bug
// that causes tooltips to be hidden behind the Windows taskbar
// Copyright (C) kangfucius, 2007
using System;
using System.Diagnostics;
using System.Text;
using System.Runtime.InteropServices;

public delegate bool CallBackPtr(int hWnd, uint lParam);

// TopmostToolTips
namespace TTT
class Program
// Win32 constants
private const Int32 HWND_TOPMOST = -1;
private const uint SWP_NOSIZE = 0x0001;
private const uint SWP_NOMOVE = 0x0002;

private static string CLASS_FILTER = "tooltips_class32";

public static extern int EnumWindows(CallBackPtr callPtr, uint lParam);

public static extern int GetClassName(int hWnd, StringBuilder className, int nMaxCount);

public static extern int SetWindowPos(int hWnd, int hWnndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);

public static bool TopmostToolTips(int hWnd, uint lParam)
StringBuilder sbClassName = new StringBuilder(256);
GetClassName(hWnd, sbClassName, sbClassName.Capacity);

Debug.WriteLine("hWnd=" + hWnd + " class=" + sbClassName.ToString());
if (CLASS_FILTER.Equals(sbClassName.ToString()))
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

return true;

static void Main(string[] args)
Console.WriteLine("TTT - set Tool Tip windows in Top-most position");
Console.WriteLine("Copyright kangfucius 2007. All rights reserved");
CallBackPtr callback = new CallBackPtr(Program.TopmostToolTips);
Program.EnumWindows(callback, 0);