1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| void CreateTooltip (HWND hwnd, char *lptstr)
{
INITCOMMONCONTROLSEX iccex;
HWND hwndTT;
TOOLINFO ti;
unsigned int uid = 0;
char tmp[5];
static RECT rect;
iccex.dwICC = ICC_WIN95_CLASSES;
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCommonControlsEx(&iccex);
hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS,
NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, NULL, hInst, NULL);
SetWindowPos(hwndTT, HWND_TOPMOST, 0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
GetClientRect (hwnd, &rect);
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hwnd;
ti.hinst = hInst;
ti.uId = uid;
ti.lpszText = lptstr;
//
ti.rect.left = rect.left;
ti.rect.top = rect.top;
ti.rect.right = rect.right;
ti.rect.bottom = rect.bottom;
SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO) &ti);
} |
Partager