Fix:
Just before the tooltip is displayed, the List View will give LVN_GETINFOTIP notification. In the handler for that, we can get the Tooltip info. Structure by
LPNMLVGETINFOTIP pGetInfoTip = (LPNMLVGETINFOTIP) lParam;
if( wcslen ( pGetInfoTip->pszText )) {
//do the string processing on pGetInfoTip->pszText
Set the value of pGetInfoTip->pszText.
StringCbCopyW( pGetInfoTip->pszText, (wcslen( pwzTmp ) + 1) * sizeof(WCHAR) , pwzTmp)); //Setting the tooltip text
// LVN_GETINFOTIP notification will be obtained only if we set the Listview extended style
DWORD ex_style = ListView_GetExtendedListViewStyle(hwndLView);
ex_style |= LVS_EX_LABELTIP | LVS_EX_INFOTIP;
ListView_SetExtendedListViewStyle(hwndLView , ex_style);
//String Processing
HGDIOBJ hFont = reinterpret_cast
HGDIOBJ hOldFont = SelectObject( hLViewDC , hFont );
GetTextExtentPoint32( hLViewDC , (LPCTSTR)pwzTmp, nLineWidth , &sSize );
if( sSize.cx >= ( nWidth ) ){
pwzDestnText[nDestnIndex] = L'\n';
nDestnIndex++;
. . .
[The Tooltip text is extracted, manipulated and set back to the tooltip structure.]
No comments:
Post a Comment