I want to use the native windows tooltip control (pure Win32 API, no MFC stuff).
I read the doc, it seems that I have to send a TTM_ADDTOOL message to bond a tool to
Addition Windows 10 (Visual Studio 2015, Win32 Console Application)
#include "Commctrl.h"
#pragma comment (lib,"comctl32.lib")
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
TOOLINFOW ti = {};
ti.cbSize = sizeof(TOOLINFOW);
ti.uFlags = TTF_ABSOLUTE | TTF_IDISHWND | TTF_TRACK ; // WITH TTF_TRACK! Otherwise the tooltip doesn't follow TTM_TRACKPOSITION message!
ti.hwnd = toolTipWnd;
ti.hinst = 0;
ti.uId = (UINT)toolTipWnd;
ti.lpszText = L"";
LRESULT result;
int error;
if (!SendMessageW(toolTipWnd, TTM_ADDTOOLW, 0, (LPARAM)&ti)) {
MessageBox(NULL, L"Couldn't create the ToolTip control.", L"Error", MB_OK);
error = 0;
error = GetLastError();
}
if (!SendMessageW(toolTipWnd, TTM_SETMAXTIPWIDTH, 0, (LPARAM)350)) {
MessageBox(NULL, L"Couldn't create the ToolTip control.", L"Error", MB_OK);
error = 0;
error = GetLastError();
}