diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-07-12 13:05:41 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-07-12 13:05:41 +0000 |
commit | 1ce24a193a3638446559843b6cf53a39530f4157 (patch) | |
tree | 1f86acd1bd7e2e35f7bdb686f879d00e90670fad /cppe/demo/IceE/minimal/WinCEClient.cpp | |
parent | merged in HandleWrapper fix from IceE. (diff) | |
download | ice-1ce24a193a3638446559843b6cf53a39530f4157.tar.bz2 ice-1ce24a193a3638446559843b6cf53a39530f4157.tar.xz ice-1ce24a193a3638446559843b6cf53a39530f4157.zip |
Added WinCE version of the minimal server/client.
Diffstat (limited to 'cppe/demo/IceE/minimal/WinCEClient.cpp')
-rw-r--r-- | cppe/demo/IceE/minimal/WinCEClient.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cppe/demo/IceE/minimal/WinCEClient.cpp b/cppe/demo/IceE/minimal/WinCEClient.cpp new file mode 100644 index 00000000000..095e203feb5 --- /dev/null +++ b/cppe/demo/IceE/minimal/WinCEClient.cpp @@ -0,0 +1,60 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 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 <IceE/IceE.h> +#include <Hello.h> + +using namespace std; +using namespace Demo; + +int WINAPI +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) +{ + extern int __argc; + extern char **__argv; + + int status; + Ice::CommunicatorPtr communicator; + + try + { + communicator = Ice::initialize(__argc, __argv); + HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000")); + if(!hello) + { + MessageBox(NULL, L"invalid proxy", L"Minimal Client", MB_ICONEXCLAMATION | MB_OK); + return EXIT_FAILURE; + } + hello->sayHello(); + } + catch(const Ice::Exception& ex) + { + char buf[1024]; + sprintf(buf, "%s\n", ex.toString().c_str());
+ TCHAR wtext[1024];
+ mbstowcs(wtext, buf, strlen(buf)); + MessageBox(NULL, wtext, L"Minimal Client", MB_ICONEXCLAMATION | MB_OK); + status = EXIT_FAILURE; + } + + if(communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::Exception& ex) + { + fprintf(stderr, "%s\n", ex.toString().c_str()); + status = EXIT_FAILURE; + } + } + + return status; +} |