diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-08-08 06:25:23 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-08-08 06:25:23 +0000 |
commit | 453db3b1a4a3b0ff3ebce7301f41ae3e5013ff5b (patch) | |
tree | ed9c573496be98bbc855a693e529f49bb79f7fc4 /cppe/demo/IceE/minimal/WinCEClient.cpp | |
parent | Added seperate CE resource files. Fixed font problems. Cleaned up and fixed (diff) | |
download | ice-453db3b1a4a3b0ff3ebce7301f41ae3e5013ff5b.tar.bz2 ice-453db3b1a4a3b0ff3ebce7301f41ae3e5013ff5b.tar.xz ice-453db3b1a4a3b0ff3ebce7301f41ae3e5013ff5b.zip |
cleaned up minimal demo.
Diffstat (limited to 'cppe/demo/IceE/minimal/WinCEClient.cpp')
-rw-r--r-- | cppe/demo/IceE/minimal/WinCEClient.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/cppe/demo/IceE/minimal/WinCEClient.cpp b/cppe/demo/IceE/minimal/WinCEClient.cpp index 02cd62be7e0..e7ba1e21b13 100644 --- a/cppe/demo/IceE/minimal/WinCEClient.cpp +++ b/cppe/demo/IceE/minimal/WinCEClient.cpp @@ -25,21 +25,27 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd try { communicator = Ice::initialize(__argc, __argv); + // + // We use a fixed string so that the demo will run without a + // configuration file. + // 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(); + MessageBox(NULL, L"Sent \"sayHello()\" message", L"Minimal Client", MB_ICONEXCLAMATION | MB_OK); } 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); + TCHAR wtext[1024]; + string err = ex.toString(); + mbstowcs(wtext, err.c_str(), err.size()); + MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK); + status = EXIT_FAILURE; } @@ -51,7 +57,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd } catch(const Ice::Exception& ex) { - fprintf(stderr, "%s\n", ex.toString().c_str()); + TCHAR wtext[1024]; + string err = ex.toString(); + mbstowcs(wtext, err.c_str(), err.size()); + MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK); + status = EXIT_FAILURE; } } |