Changeset 21544 for trunk/src/user32/oslibwin.cpp
- Timestamp:
- Jan 7, 2011, 1:51:26 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/oslibwin.cpp
r21463 r21544 30 30 #include "pmwindow.h" 31 31 #include "initterm.h" 32 #include "codepage.h" 32 33 33 34 #define DBG_LOCALLOG DBG_oslibwin … … 574 575 BOOL OSLibWinSetTitleBarText(HWND hwnd, LPSTR lpsz) 575 576 { 576 return WinSetWindowText(WinWindowFromID(hwnd, FID_TITLEBAR), lpsz); 577 // convert character code if needed (normally, only on the main 578 // thread since Win32ThreadProc() sets the HMQ code page to the 579 // Windows ANSI code page so that all threads created by Win32 API 580 // will be already in the ANSI code page) 581 ULONG cpFrom, cpTo; 582 cpFrom = cpTo = GetDisplayCodepage(); 583 HMQ hmq = (HMQ)WinQueryWindowULong(hwnd, QWL_HMQ); 584 if (hmq) 585 cpTo = WinQueryCp(hmq); 586 587 LPSTR psz = NULL; 588 if(lpsz && cpFrom != cpTo) { 589 int size = (strlen(lpsz) + 1) * 2; // count for DBCS just in case 590 psz = (LPSTR)_smalloc(size); 591 if (WinCpTranslateString(GetThreadHAB(), cpFrom, lpsz, cpTo, size, psz)) { 592 dprintf(("OSLibWinSetTitleBarTextCp: cp%d->cp%d", cpFrom, cpTo)); 593 lpsz = psz; 594 } else { 595 dprintf(("OSLibWinSetTitleBarTextCp: ERROR: cp%d->cp%d failed!", cpFrom, cpTo)); 596 } 597 } 598 BOOL rc = WinSetWindowText(WinWindowFromID(hwnd, FID_TITLEBAR), lpsz); 599 if (psz) { 600 _sfree(psz); 601 } 602 return rc; 577 603 } 578 604 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.