2010年9月22日 星期三

window title unicode problem [Archive] - CodeGuru Forums

window title unicode problem [Archive] - CodeGuru Forums



[Archive] window title unicode problem C++ and WinAPI.window title unicode problem [Archive] - CodeGuru Forums CodeGuru Forums Visual C++ C++ Programming C++ and WinAPI window title unicode problem PDA Click to See Complete Forum and Search --> : window title unicode problem fezztahMarch 28th, 2007, 05:09 AMI'm preparing an application for use in Russia, it's very simple, just a single dialog with buttons, titles and some static text. #ifdef _RUSSIA wchar_t wbuff[256]; wcscpy( wbuff, L ); //DefWindowProcW( hWnd, WM_SETTEXT, 0, (LPARAM)wbuff ); SetWindowTextW( hWnd, wbuff ); hdl = GetDlgItem( hWnd, IDC_GRAPHICSGROUPBOX ); wcscpy( wbuff, L ); SendMessageW( hdl, WM_SETTEXT, 0, (LPARAM)wbuff ); /*more calls to other controls*/ #else SetWindowTextW( hWnd, MyApp ); #endif When I run it in English then everything is great. In Russian mode the SendMessageW calls work fine - buttons, box titles, static text - everything translated perfectly. The call to SetWindowTextW or DefWindowProcW to change the main dialog title text does not work, I just get ????? when it runs. Does anybody know what I'm doing wrong? Boris K KMarch 28th, 2007, 06:40 AMDo I understand correctly that using the same technique you are able to display Cyrillic text in every control except the title bar of the main window? Did you check, for example with Spy++, if the title is set correctly. In other words, is it an issue with setting the text or just with displaying it? MikeAThonMarch 28th, 2007, 12:25 PMIn _RUSSIA mode, you might need to define _UNICODE too, so that the windows.h definitions are in sync with your own internal definitions. For example, we all know that the SetWindowText funtion causes a WM_SETTEXT message to be sent to the specified window. You explicitly told Windows to use the SetWindowTextW function. But when that function (in turn) calls SendMessage, because _UNICODE is not set, Windows probabaly calls SendMessageA and not SendMessageW. Are you certain that English mode works correctly? This line looks suspicious: SetWindowTextW( hWn...

全文 | Detail, 來源 | Source

沒有留言:

張貼留言