visual c++ - how to create tooltips with arabic text in mfc application -
i want create simple mfc application uses rtl property display tooltip given arabic text content edit box in application dialog. code looks this:
hwnd cmfcapplicationdlg::createtooltip(hwnd hwnd, lpctstr sztext){ hwndtt = createwindowex(null, tooltips_class, null, ws_popup | tts_alwaystip | tts_balloon, cw_usedefault, cw_usedefault, cw_usedefault, cw_usedefault, m_hwnd, null, getmodulehandle(null), null); if(!hwndtt) { return null; } if (sztext == null) { ::destroywindow(hwndtt); hwndtt = null; return null; } // set tool information. in case, "tool" entire parent window toolitem.cbsize = sizeof(toolitem); toolitem.uflags = ttf_idishwnd | ttf_subclass | ttf_rtlreading;//setting rtl flag here toolitem.hwnd = m_hwnd; toolitem.hinst = getmodulehandle(null); toolitem.lpsztext = (wchar_t *)sztext; toolitem.uid = (uint_ptr)hwnd; ::getclientrect(hwnd, &toolitem.rect); // associate tooltip tool window lresult result = ::sendmessage(hwndtt, ttm_addtool, 0, (lparam)&toolitem); return hwndtt; } i'm calling function oninitdialog() method way:
createtooltip((hwnd)getdlgitem(idc_edit_dummy), l".استخدم 2 من المرات في اليوم"); here idc_edit_dummy id edit box trying attach tooltip with. reason, application doesn't display tooltip @ all. going wrong?
the mfc has it's own tooltip implementation. may easier use instead of using plain win32 tooltips.
you can use cwnd::eanabletooltips activate it. msdn doku (see link contains full sample)
also code project has sample it.
Comments
Post a Comment