diff options
Diffstat (limited to 'cpp/demo/Ice/MFC/client/HelloClient.cpp')
-rw-r--r-- | cpp/demo/Ice/MFC/client/HelloClient.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/cpp/demo/Ice/MFC/client/HelloClient.cpp b/cpp/demo/Ice/MFC/client/HelloClient.cpp new file mode 100644 index 00000000000..ceb2bdbe2c6 --- /dev/null +++ b/cpp/demo/Ice/MFC/client/HelloClient.cpp @@ -0,0 +1,82 @@ +// **********************************************************************
+//
+// Copyright (c) 2003
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+#include "stdafx.h"
+#include "HelloClient.h"
+#include "HelloClientDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+BEGIN_MESSAGE_MAP(CHelloClientApp, CWinApp)
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+CHelloClientApp::CHelloClientApp()
+{
+ // Place all significant initialization in InitInstance
+}
+
+// The one and only CHelloClientApp object
+
+CHelloClientApp theApp;
+
+BOOL
+CHelloClientApp::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
+ {
+ int argc = 0;
+ communicator = Ice::initialize(argc, 0);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ std::ostringstream ostr;
+ ostr << ex;
+ std::string s = ostr.str();
+ AfxMessageBox(CString(s.c_str()), MB_OK|MB_ICONEXCLAMATION);
+ return FALSE;
+ }
+
+ CHelloClientDlg 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;
+}
|