diff options
author | Joe George <joe@zeroc.com> | 2015-03-03 17:30:50 -0500 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2015-05-12 11:41:55 -0400 |
commit | d35bb9f5c19e34aee31f83d445695a8186ef675e (patch) | |
tree | d5324eaf44f5f9776495537c51653f50a66a7237 /cpp/demo/IcePatch2/MFC/PatchClient.cpp | |
download | ice-d35bb9f5c19e34aee31f83d445695a8186ef675e.tar.bz2 ice-d35bb9f5c19e34aee31f83d445695a8186ef675e.tar.xz ice-d35bb9f5c19e34aee31f83d445695a8186ef675e.zip |
Ice 3.4.2 Source Distributionv3.4.2
Diffstat (limited to 'cpp/demo/IcePatch2/MFC/PatchClient.cpp')
-rw-r--r-- | cpp/demo/IcePatch2/MFC/PatchClient.cpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/cpp/demo/IcePatch2/MFC/PatchClient.cpp b/cpp/demo/IcePatch2/MFC/PatchClient.cpp new file mode 100644 index 00000000000..26119171f18 --- /dev/null +++ b/cpp/demo/IcePatch2/MFC/PatchClient.cpp @@ -0,0 +1,89 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include "stdafx.h" +#include "PatchClient.h" +#include "PatchClientDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +BEGIN_MESSAGE_MAP(CPatchClientApp, CWinApp) + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +using namespace std; + +CPatchClientApp::CPatchClientApp() +{ + // Place all significant initialization in InitInstance +} + +// The one and only CPatchClientApp object + +CPatchClientApp theApp; + +BOOL +CPatchClientApp::InitInstance() +{ + // InitCommonControls() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + InitCommonControls(); + + CWinApp::InitInstance(); + + // + // Create a communicator. + // + Ice::CommunicatorPtr communicator; + try + { + 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) + { + ostringstream ostr; + ostr << ex; + string s = ostr.str(); + AfxMessageBox(CString(s.c_str()), MB_OK|MB_ICONEXCLAMATION); + return FALSE; + } + + Ice::PropertiesPtr properties = communicator->getProperties(); + if(properties->getProperty("IcePatch2.Endpoints").empty()) + { + properties->setProperty("IcePatch2.Endpoints", "tcp -h 127.0.0.1 -p 10000"); + } + + CPatchDlg dlg(communicator); + m_pMainWnd = &dlg; + dlg.DoModal(); + + // + // Clean up. + // + try + { + communicator->destroy(); + } + catch(const IceUtil::Exception&) + { + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} |