Witajcie, stworzyłem sobie taką funkcję na tooltipy do przycisków/checkboxów:
void CreateTooltip(HWND hwndParent, std::string tooltip, HINSTANCE hInstance, std::string title="")
{
HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hwndParent, NULL, hInstance,NULL);
SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TOOLINFO ti = { 0 };
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hwndParent;
ti.hinst = hInstance;
ti.lpszText = TEXT(const_cast<char*>(tooltip.c_str()));
GetClientRect (hwndParent, &ti.rect);
SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
if( title != "" )
{
SendMessage( hwndTT, TTM_SETTITLE, 1,( LPARAM ) const_cast<char*>(title.c_str()) );
}
}
Mój problem polega na tym, że gdy kontrolka staje się nieaktywna (funkcja EnableWindow()
), tooltip nie wyświetla się po najechaniu na nią. Jak mogę to naprawić?