- Timestamp:
- Jan 7, 2011, 1:51:26 AM (15 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 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 //****************************************************************************** -
trunk/src/user32/win32wbase.cpp
r21529 r21544 528 528 //****************************************************************************** 529 529 //****************************************************************************** 530 static BOOL OSLibWinSetTitleBarTextA(HWND hwnd, LPSTR lpsz)531 {532 LPSTR psz = NULL;533 if(lpsz) {534 psz = (LPSTR)_smalloc(strlen(lpsz) + 1);535 CharToOemA(lpsz, psz);536 }537 BOOL rc = OSLibWinSetTitleBarText(hwnd, psz);538 if (psz) {539 _sfree(psz);540 }541 return rc;542 }543 //******************************************************************************544 //******************************************************************************545 530 BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2) 546 531 { … … 635 620 636 621 if(fOS2Look) { 637 OSLibWinSetTitleBarText A(OS2HwndFrame, windowNameA);622 OSLibWinSetTitleBarText(OS2HwndFrame, windowNameA); 638 623 } 639 624 } … … 1664 1649 } 1665 1650 if(fOS2Look) { 1666 OSLibWinSetTitleBarText A(OS2HwndFrame, getWindowNameA());1651 OSLibWinSetTitleBarText(OS2HwndFrame, getWindowNameA()); 1667 1652 } 1668 1653 } … … 2240 2225 } 2241 2226 if(fOS2Look) { 2242 OSLibWinSetTitleBarText A(OS2HwndFrame, getWindowNameA());2227 OSLibWinSetTitleBarText(OS2HwndFrame, getWindowNameA()); 2243 2228 } 2244 2229 }
Note:
See TracChangeset
for help on using the changeset viewer.