I am creating a window which opens to a dynamic title. I would like to have the window's title truncate if the window is resized and there isn't room to show the full title.
For example, I have
HWND handle = GetHWND(); // gets me the correct handle
std::wstring title = L"some fairly long window title";
SetWindowTextW(handle, title.c_str());
Is there either a way to truncate the HWND title automatically or alternately a way to get the pixel width of the title text so I can set the title manually if the window shrinks?