use only ANSI APIs and ConvertUTF8ToACP

This commit is contained in:
Chris Danford
2006-01-17 22:20:27 +00:00
parent b60126a261
commit 7b75640337
4 changed files with 8 additions and 15 deletions
@@ -80,7 +80,7 @@ static HWND GetHwnd()
#endif #endif
} }
static wstring GetWindowTitle() static RString GetWindowTitle()
{ {
RString s; RString s;
#if !defined(SMPACKAGE) #if !defined(SMPACKAGE)
@@ -88,7 +88,7 @@ static wstring GetWindowTitle()
#else #else
s = PRODUCT_NAME; s = PRODUCT_NAME;
#endif #endif
return RStringToWstring( s ); return s;
} }
void DialogDriver_Win32::OK( RString sMessage, RString sID ) void DialogDriver_Win32::OK( RString sMessage, RString sID )
@@ -176,8 +176,7 @@ void DialogDriver_Win32::Error( RString sError, RString sID )
Dialog::Result DialogDriver_Win32::AbortRetryIgnore( RString sMessage, RString ID ) Dialog::Result DialogDriver_Win32::AbortRetryIgnore( RString sMessage, RString ID )
{ {
wstring wsMessage = RStringToWstring(sMessage); switch( MessageBox(::GetHwnd(), ConvertUTF8ToACP(sMessage).c_str(), ConvertUTF8ToACP(::GetWindowTitle()).c_str(), MB_ABORTRETRYIGNORE|MB_DEFBUTTON3 ) )
switch( MessageBoxW(::GetHwnd(), wsMessage.c_str(), ::GetWindowTitle().c_str(), MB_ABORTRETRYIGNORE|MB_DEFBUTTON3 ) )
{ {
case IDABORT: return Dialog::abort; case IDABORT: return Dialog::abort;
case IDRETRY: return Dialog::retry; case IDRETRY: return Dialog::retry;
@@ -188,8 +187,7 @@ Dialog::Result DialogDriver_Win32::AbortRetryIgnore( RString sMessage, RString I
Dialog::Result DialogDriver_Win32::AbortRetry( RString sMessage, RString sID ) Dialog::Result DialogDriver_Win32::AbortRetry( RString sMessage, RString sID )
{ {
wstring wsMessage = RStringToWstring(sMessage); switch( MessageBox(::GetHwnd(), ConvertUTF8ToACP(sMessage).c_str(), ConvertUTF8ToACP(::GetWindowTitle()).c_str(), MB_RETRYCANCEL) )
switch( MessageBoxW(::GetHwnd(), wsMessage.c_str(), ::GetWindowTitle().c_str(), MB_RETRYCANCEL) )
{ {
case IDRETRY: return Dialog::retry; case IDRETRY: return Dialog::retry;
default: ASSERT(0); default: ASSERT(0);
@@ -151,8 +151,7 @@ void LoadingWindow_Win32::SetText( CString sText )
HWND hwndItem = ::GetDlgItem( hwnd, msgid[i] ); HWND hwndItem = ::GetDlgItem( hwnd, msgid[i] );
wstring w = RStringToWstring( asMessageLines[i] ); ::SetWindowText( hwndItem, ConvertUTF8ToACP(asMessageLines[i]).c_str() );
::SetWindowTextW( hwndItem, w.c_str() );
} }
} }
+2 -6
View File
@@ -55,8 +55,6 @@ void DialogUtil::SetHeaderFont( HWND hdlg, int nID )
void DialogUtil::LocalizeDialogAndContents( HWND hdlg ) void DialogUtil::LocalizeDialogAndContents( HWND hdlg )
{ {
// TODO: No SetWindowTextW on Win9x
const int LARGE_STRING = 256; const int LARGE_STRING = 256;
char szTemp[LARGE_STRING] = ""; char szTemp[LARGE_STRING] = "";
RString sGroup; RString sGroup;
@@ -66,8 +64,7 @@ void DialogUtil::LocalizeDialogAndContents( HWND hdlg )
RString s = szTemp; RString s = szTemp;
sGroup = "Tools-"+s; sGroup = "Tools-"+s;
s = THEME->GetString( sGroup, s ); s = THEME->GetString( sGroup, s );
wstring w = RStringToWstring( s ); ::SetWindowText( hdlg, ConvertUTF8ToACP(s).c_str() );
::SetWindowTextW( hdlg, w.c_str() );
} }
for( HWND hwndChild = ::GetTopWindow(hdlg); hwndChild != NULL; hwndChild = ::GetNextWindow(hwndChild,GW_HWNDNEXT) ) for( HWND hwndChild = ::GetTopWindow(hdlg); hwndChild != NULL; hwndChild = ::GetNextWindow(hwndChild,GW_HWNDNEXT) )
@@ -77,8 +74,7 @@ void DialogUtil::LocalizeDialogAndContents( HWND hdlg )
if( s.empty() ) if( s.empty() )
continue; continue;
s = THEME->GetString( sGroup, s ); s = THEME->GetString( sGroup, s );
wstring w = RStringToWstring( s ); ::SetWindowText( hwndChild, ConvertUTF8ToACP(s).c_str() );
::SetWindowTextW( hwndChild, w.c_str() );
} }
} }
@@ -302,7 +302,7 @@ void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForce
{ {
if( m_bWideWindowClass ) if( m_bWideWindowClass )
{ {
if( SetWindowTextW( g_hWndMain, RStringToWstring(p.sWindowTitle).c_str() ) ) if( SetWindowText( g_hWndMain, ConvertUTF8ToACP(p.sWindowTitle).c_str() ) )
break; break;
} }