diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-12-04 14:57:03 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-12-04 14:57:03 +0000 |
commit | cdbf4d253619a8fb24968b52a0ce6fcd501e93ef (patch) | |
tree | 4ffd98172874016cb5fd06e1fa768cd3eac3363c /cpp/demo/IcePatch2/MFC | |
parent | update JGoodies library versions (diff) | |
download | ice-cdbf4d253619a8fb24968b52a0ce6fcd501e93ef.tar.bz2 ice-cdbf4d253619a8fb24968b52a0ce6fcd501e93ef.tar.xz ice-cdbf4d253619a8fb24968b52a0ce6fcd501e93ef.zip |
Changed to use Unicode
Diffstat (limited to 'cpp/demo/IcePatch2/MFC')
-rwxr-xr-x | cpp/demo/IcePatch2/MFC/Makefile.mak | 8 | ||||
-rwxr-xr-x | cpp/demo/IcePatch2/MFC/PatchClient.cpp | 7 | ||||
-rwxr-xr-x | cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp | 50 |
3 files changed, 35 insertions, 30 deletions
diff --git a/cpp/demo/IcePatch2/MFC/Makefile.mak b/cpp/demo/IcePatch2/MFC/Makefile.mak index 057f2d3eb5b..9cc346d6960 100755 --- a/cpp/demo/IcePatch2/MFC/Makefile.mak +++ b/cpp/demo/IcePatch2/MFC/Makefile.mak @@ -9,7 +9,7 @@ top_srcdir = ..\..\.. -CLIENT = client.exe +CLIENT = patch.exe TARGETS = $(CLIENT) @@ -21,7 +21,7 @@ SRCS = $(OBJS:.obj=.cpp) !include $(top_srcdir)/config/Make.rules.mak -CPPFLAGS = -I. $(CPPFLAGS) -D_AFXDLL -DVC_EXTRALEAN +CPPFLAGS = -I. $(CPPFLAGS) -D_AFXDLL -DVC_EXTRALEAN -D_UNICODE LINKWITH = icepatch2$(LIBSUFFIX).lib $(LIBS) !if "$(BORLAND_HOME)" == "" & "$(OPTIMIZE)" != "yes" @@ -29,8 +29,8 @@ PDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) !endif $(CLIENT): $(OBJS) $(COBJS) PatchClient.res - $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) /subsystem:windows $(OBJS) $(COBJS) PatchClient.res \ - $(PREOUT)$@ $(PRELIBS)$(LINKWITH) + $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) /entry:wWinMainCRTStartup /subsystem:windows $(OBJS) $(COBJS) \ + PatchClient.res $(PREOUT)$@ $(PRELIBS)$(LINKWITH) PatchClient.res: PatchClient.rc rc.exe PatchClient.rc diff --git a/cpp/demo/IcePatch2/MFC/PatchClient.cpp b/cpp/demo/IcePatch2/MFC/PatchClient.cpp index 1a4108e540c..7a09b34e78d 100755 --- a/cpp/demo/IcePatch2/MFC/PatchClient.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClient.cpp @@ -46,7 +46,12 @@ CPatchClientApp::InitInstance() Ice::CommunicatorPtr communicator; try { - communicator = Ice::initialize(__argc, __argv); + Ice::StringSeq args; + for(int i = 0; i < __argc; ++i) + { + args.push_back(IceUtil::wstringToString(__wargv[i])); + } + communicator = Ice::initialize(args); } catch(const IceUtil::Exception& ex) { diff --git a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp index d0f1a0c6d6e..641e2792869 100755 --- a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp @@ -34,7 +34,7 @@ public: virtual bool noFileSummary(const string& reason) { - return IDYES == AfxMessageBox("Cannot load file summary. Perform a thorough patch?", MB_YESNO|MB_ICONSTOP); + return IDYES == AfxMessageBox(L"Cannot load file summary. Perform a thorough patch?", MB_YESNO|MB_ICONSTOP); } virtual bool @@ -115,7 +115,7 @@ CPatchDlg::CPatchDlg(const Ice::CommunicatorPtr& communicator, CWnd* pParent /*= bool CPatchDlg::checksumStart() { - _status->SetWindowText(CString(" Calculating checksums...")); + _status->SetWindowText(CString(L" Calculating checksums...")); _progress->SetRange(0, 0); _progress->SetPos(0); @@ -130,7 +130,7 @@ CPatchDlg::checksumProgress(const string& path) // TODO: indicate busy progress CString file; - file.Format(" %s", IcePatch2::getBasename(path).c_str()); + file.Format(L" %s", IceUtil::stringToWstring(IcePatch2::getBasename(path)).c_str()); _file->SetWindowText(file); processMessages(); @@ -147,7 +147,7 @@ CPatchDlg::checksumEnd() bool CPatchDlg::fileListStart() { - _status->SetWindowText(CString(" Retrieving file list...")); + _status->SetWindowText(CString(L" Retrieving file list...")); _progress->SetRange(0, 100); _progress->SetPos(0); @@ -160,7 +160,7 @@ bool CPatchDlg::fileListProgress(Ice::Int pcnt) { CString percent; - percent.Format("%d%%", pcnt); + percent.Format(L"%d%%", pcnt); _percent->SetWindowText(percent); _progress->SetPos(pcnt); @@ -182,13 +182,13 @@ CPatchDlg::patchStart(const string& path, Ice::Long size, Ice::Long totalProgres if(!_isPatch) { _startTime = IceUtil::Time::now(); - _status->SetWindowText(CString(" Patching...")); - _speed->SetWindowText(CString(" 0.0 KB/s")); + _status->SetWindowText(CString(L" Patching...")); + _speed->SetWindowText(CString(L" 0.0 KB/s")); _isPatch = true; } CString file; - file.Format(" %s", IcePatch2::getBasename(path).c_str()); + file.Format(L" %s", IceUtil::stringToWstring(IcePatch2::getBasename(path)).c_str()); _file->SetWindowText(file); return patchProgress(0, size, totalProgress, totalSize); @@ -201,7 +201,7 @@ CPatchDlg::patchProgress(Ice::Long, Ice::Long, Ice::Long totalProgress, Ice::Lon if(elapsed.toSeconds() > 0) { CString speed; - speed.Format(" %s/s", convertSize(totalProgress / elapsed.toSeconds())); + speed.Format(L" %s/s", convertSize(totalProgress / elapsed.toSeconds())); _speed->SetWindowText(speed); } @@ -211,11 +211,11 @@ CPatchDlg::patchProgress(Ice::Long, Ice::Long, Ice::Long totalProgress, Ice::Lon pcnt = static_cast<int>(totalProgress * 100 / totalSize); } CString percent; - percent.Format("%d%%", pcnt); + percent.Format(L"%d%%", pcnt); _percent->SetWindowText(percent); CString total; - total.Format(" %s / %s", convertSize(totalProgress), convertSize(totalSize)); + total.Format(L" %s / %s", convertSize(totalProgress), convertSize(totalSize)); _total->SetWindowText(total); _progress->SetPos(pcnt); @@ -276,19 +276,19 @@ CPatchDlg::OnInitDialog() // Set the patch directory and thorough flag from properties. // Ice::PropertiesPtr properties = _communicator->getProperties(); - CString path = properties->getPropertyWithDefault("IcePatch2.Directory", "").c_str(); + CString path = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Directory", "")).c_str(); _path->SetWindowText(path); - CString thorough = properties->getPropertyWithDefault("IcePatch2.Thorough", "0").c_str(); + CString thorough = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Thorough", "0")).c_str(); _thorough->SetCheck(thorough != "0"); - CString remove = properties->getPropertyWithDefault("IcePatch2.Remove", "0").c_str(); + CString remove = IceUtil::stringToWstring(properties->getPropertyWithDefault("IcePatch2.Remove", "0")).c_str(); _remove->SetCheck(remove != "0"); // // Indicate ready status. // - reset(" Ready"); + reset(L" Ready"); return TRUE; // return TRUE unless you set the focus to a control } @@ -374,10 +374,10 @@ CPatchDlg::OnStartPatch() _path->GetWindowText(path); if(path.IsEmpty()) { - AfxMessageBox(CString("Please select a patch directory."), MB_OK|MB_ICONEXCLAMATION); + AfxMessageBox(CString(L"Please select a patch directory."), MB_OK|MB_ICONEXCLAMATION); return; } - properties->setProperty("IcePatch2.Directory", string(path)); + properties->setProperty("IcePatch2.Directory", IceUtil::wstringToString(wstring(path))); // // Set the thorough patch flag. @@ -419,7 +419,7 @@ CPatchDlg::OnStartPatch() // // Reset and indicate the completion status. // - reset(aborted ? " Aborted" : " Completed"); + reset(aborted ? L" Aborted" : L" Completed"); } catch(const IceUtil::Exception& ex) { @@ -435,7 +435,7 @@ void CPatchDlg::OnCancel() { _isCancel = true; - _status->SetWindowText(CString(" Canceled")); + _status->SetWindowText(CString(L" Canceled")); CDialog::OnCancel(); } @@ -485,7 +485,7 @@ CPatchDlg::handleException(const IceUtil::Exception& e) AfxMessageBox(CString(s.c_str()), MB_OK|MB_ICONEXCLAMATION); } - reset(" Ready"); + reset(L" Ready"); } CString @@ -496,31 +496,31 @@ CPatchDlg::convertSize(Ice::Long size) const double final = start / gigabyte; if(final >= 1) { - units = "GB"; + units = L"GB"; } else { final = start / megabyte; if(final >= 1) { - units = "MB"; + units = L"MB"; } else { final = start / kilobyte; if(final >= 1) { - units = "KB"; + units = L"KB"; } else { final = start; - units = "B"; + units = L"B"; } } } CString convert; - convert.Format("%.1f %s", final, units); + convert.Format(L"%.1f %s", final, units); return convert; } |