0
我想創建一個簡單的MFC應用程序,該應用程序使用RTL屬性在應用程序對話框中爲編輯框顯示具有給定阿拉伯文本內容的工具提示。 我的代碼如下所示:如何在mfc應用程序中使用阿拉伯語文本創建工具提示
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 up the tool information. In this case, the "tool" is the 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 the tooltip with the tool window
LRESULT result = ::SendMessage(hWndTT, TTM_ADDTOOL, 0, (LPARAM)&toolItem);
return hWndTT;
}
我這樣調用從的OnInitDialog這個函數()方法:
CreateToolTip((HWND)GetDlgItem(IDC_EDIT_DUMMY), L".استخدم 2 من المرات في اليوم");
這裏IDC_EDIT_DUMMY是,我試圖附加編輯框中的ID工具提示。但由於某種原因,應用程序根本不顯示工具提示。我哪裏錯了?