diff options
Diffstat (limited to 'cppe/demo/IceE/minimal/WinCEClient.cpp')
-rw-r--r-- | cppe/demo/IceE/minimal/WinCEClient.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/cppe/demo/IceE/minimal/WinCEClient.cpp b/cppe/demo/IceE/minimal/WinCEClient.cpp index e7ba1e21b13..7d8674e2cbc 100644 --- a/cppe/demo/IceE/minimal/WinCEClient.cpp +++ b/cppe/demo/IceE/minimal/WinCEClient.cpp @@ -24,12 +24,29 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd try { - communicator = Ice::initialize(__argc, __argv); + Ice::PropertiesPtr properties = Ice::createProperties(); + + // + // Set a default value for "Hello.Proxy" so that the demo will + // run without a configuration file. + // + properties->setProperty("Hello.Proxy", "hello:tcp -p 10000"); + // - // We use a fixed string so that the demo will run without a - // configuration file. + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. // - HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000")); + try + { + properties->load("config.txt"); + } + catch(const Ice::FileException&) + { + } + + communicator = Ice::initializeWithProperties(__argc, __argv, properties); + + HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy(properties->getProperty("Hello.Proxy"))); if(!hello) { MessageBox(NULL, L"invalid proxy", L"Minimal Client", MB_ICONEXCLAMATION | MB_OK); |