|
From: andrew7 <bd...@us...> - 2007-06-10 03:59:27
|
Update of /cvsroot/smartwin/SmartWin/tests/swDll In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv10827 Modified Files: ResourceDialogClass.h helloDll.h swDll.cpp swDllswMain.cpp Log Message: Adjustment for unicode and mbs operation Index: swDllswMain.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/swDll/swDllswMain.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- swDllswMain.cpp 19 Feb 2007 02:24:03 -0000 1.1 +++ swDllswMain.cpp 10 Jun 2007 03:59:24 -0000 1.2 @@ -34,7 +34,8 @@ // Dll gets values with a GUI. if ( guiGetNumberAndString( & numb, ( char * ) & str ) ) { - createMessageBox().show( _T( "Hello !" ), str ); + createMessageBox().show( _T( "Hello !" ), + SmartUtil::Ascii2CurrentBuild::doConvert( str, SmartUtil::ConversionCodepage::ANSI ) ); } } @@ -52,7 +53,8 @@ // Same thing but this time the DLL does it with a dialog. if ( dialogGetNumberAndString( & numb, ( char * ) & str ) ) { - createMessageBox().show( _T( "Hello !" ), str ); + createMessageBox().show( _T( "Hello !" ), + SmartUtil::Ascii2CurrentBuild::doConvert( str, SmartUtil::ConversionCodepage::ANSI ) ); } } Index: ResourceDialogClass.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/swDll/ResourceDialogClass.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ResourceDialogClass.h 19 Feb 2007 02:24:02 -0000 1.1 +++ ResourceDialogClass.h 10 Jun 2007 03:59:24 -0000 1.2 @@ -42,10 +42,9 @@ btnOk->onClicked( & ResourceDialogClass::OkClicked ); } catch ( xCeption x ) { - SmartUtil::tstring errmsg( x.whatWndMsg() ); - errmsg += _T(" from "); - errmsg += x.what(); - createMessageBox().show( errmsg ); + std::stringstream ss; + ss << x.whatWndMsg() << " from " << x.what(); + createMessageBox().show( SmartUtil::Ascii2CurrentBuild::doConvert( ss.str(), SmartUtil::ConversionCodepage::UTF8 ) ); } } @@ -62,7 +61,8 @@ bool closing() { - strcpy( itsOutStrPtr, itsHexTxt->getText().c_str() ); + std::string s = SmartUtil::AsciiGuaranteed::doConvert( itsHexTxt->getText(), SmartUtil::ConversionCodepage::ANSI ); + strcpy( itsOutStrPtr, s.c_str() ); return true; } Index: helloDll.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/swDll/helloDll.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- helloDll.h 5 May 2006 17:14:40 -0000 1.3 +++ helloDll.h 10 Jun 2007 03:59:24 -0000 1.4 @@ -29,12 +29,12 @@ PasswordString pass1; // or ( 8, "" ) bool bool1 = true; - ChoiceString cs( "scissors|rock|paper", 2 ); + ChoiceString cs( _T("scissors|rock|paper"), 2 ); - FileString loadFs( "C:\\path\\gumbo.txt" ); - loadFs.addFilter( "JPG files", "*.jpg" ); - FileString saveFs( "", false ); - saveFs.addFilter( "JPG files", "*.jpg" ); + FileString loadFs( _T("C:\\path\\gumbo.txt") ); + loadFs.addFilter( _T("JPG files"), _T("*.jpg") ); + FileString saveFs( _T(""), false ); + saveFs.addFilter( _T("JPG files"), _T("*.jpg") ); SYSTEMTIME bookDue; ::GetSystemTime( & bookDue ); @@ -43,7 +43,7 @@ bool c; - InDialog myInDialog( this, "First InDialog Attempt !" ); + InDialog myInDialog( this, _T("First InDialog Attempt !") ); if ( IDCANCEL == myInDialog .add( _T( "Input file ..." ), & loadFs ) .add( _T( "Output file ..." ), & saveFs ) @@ -87,7 +87,7 @@ createWindow(); setText( _T( "Hello SmartWin" ) ); // Title itsInteger = - 8; - itsString = "hello via SmartWin++ window"; + itsString = _T("hello via SmartWin++ window"); SmartWin::Rectangle desktop( getDesktopSize() ); setBounds( desktop.top( 0.2 ).left( 0.3 ) ); @@ -120,7 +120,8 @@ bool isClosing() { * outIntPtr = itsInteger; - strcpy( outStrPtr, itsString.c_str() ); + std::string s = SmartUtil::AsciiGuaranteed::doConvert( itsString, SmartUtil::ConversionCodepage::ANSI ); + strcpy( outStrPtr, s.c_str() ); return true; } Index: swDll.cpp =================================================================== RCS file: /cvsroot/smartwin/SmartWin/tests/swDll/swDll.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- swDll.cpp 7 Jan 2007 18:43:05 -0000 1.5 +++ swDll.cpp 10 Jun 2007 03:59:24 -0000 1.6 @@ -48,8 +48,7 @@ bool getNumberAndString( int * numb, char str[] ) { * numb = 23; - SmartUtil::tstring tstr = "hello world from a DLL"; - strcpy( str, tstr.c_str() ); + strcpy( str, "hello world from a DLL" ); return true; } |