Hi all, I am trying to get a tooltip to work, for some reason it just will not pop up. I have followed the MSDN examples exactly. There is also a full example on FoosYerDoos, which when I compile it without changing any of the code, it still doesn't show them up. I am using VC++ 2008.
Here is my code
Code:
INITCOMMONCONTROLSEX ic;
ic.dwSize = sizeof(INITCOMMONCONTROLSEX);
ic.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&ic);
tooltiphWnd = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, L"", WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, 10, 10, 10, 10, mainhWnd, NULL, mainhInst, NULL);
SetWindowPos(tooltiphWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.uId = (UINT_PTR)mainexitButton->GethWnd();
ti.lpszText = L"This is a button.";
ti.hwnd = mainhWnd;
SendMessage(tooltiphWnd, TTM_ADDTOOL, 0, (LPARAM)&ti);
SendMessage(tooltiphWnd, TTM_ACTIVATE, true, NULL);
It should show up when I hover over my exit button. The weird thing is it doesn't work when I compile the FoosYerDoos example either, which makes me think that maybe I am not including something?
Any help would be greatly appreciated.