diff options
author | Matthew Newhook <matthew@zeroc.com> | 2005-08-09 03:44:48 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2005-08-09 03:44:48 +0000 |
commit | ede6f592b3d2b109e8c59c07c00f11b248eaeda5 (patch) | |
tree | 5e89e38fd9193b9c486cc936a9488702f4f8111e | |
parent | Fixed a few build errors (diff) | |
download | ice-ede6f592b3d2b109e8c59c07c00f11b248eaeda5.tar.bz2 ice-ede6f592b3d2b109e8c59c07c00f11b248eaeda5.tar.xz ice-ede6f592b3d2b109e8c59c07c00f11b248eaeda5.zip |
cleanup. CE demos now use config.txt
-rw-r--r-- | cppe/demo/IceE/MFC/client/HelloClient.cpp | 14 | ||||
-rw-r--r-- | cppe/demo/IceE/MFC/server/HelloServer.cpp | 13 | ||||
-rw-r--r-- | cppe/demo/IceE/chat/ChatClientDlg.cpp | 40 | ||||
-rw-r--r-- | cppe/demo/IceE/latency/Client.cpp | 2 | ||||
-rwxr-xr-x | cppe/demo/IceE/latency/WinCEClient.cpp | 16 | ||||
-rwxr-xr-x | cppe/demo/IceE/latency/WinCEServer.cpp | 9 | ||||
-rw-r--r-- | cppe/demo/IceE/latency/config | 2 | ||||
-rw-r--r-- | cppe/demo/IceE/minimal/WinCEClient.cpp | 25 | ||||
-rw-r--r-- | cppe/demo/IceE/minimal/WinCEServer.cpp | 12 | ||||
-rw-r--r-- | cppe/demo/IceE/throughput/Client.cpp | 2 | ||||
-rwxr-xr-x | cppe/demo/IceE/throughput/WinCEClient.cpp | 18 | ||||
-rwxr-xr-x | cppe/demo/IceE/throughput/WinCEServer.cpp | 12 | ||||
-rw-r--r-- | cppe/demo/IceE/throughput/config | 2 |
13 files changed, 106 insertions, 61 deletions
diff --git a/cppe/demo/IceE/MFC/client/HelloClient.cpp b/cppe/demo/IceE/MFC/client/HelloClient.cpp index 7891a1c635c..021a62a1438 100644 --- a/cppe/demo/IceE/MFC/client/HelloClient.cpp +++ b/cppe/demo/IceE/MFC/client/HelloClient.cpp @@ -52,16 +52,24 @@ CHelloClientApp::InitInstance() // run without a configuration file. // properties->setProperty("Hello.Proxy", "hello:tcp -p 10000"); + // - // Now, load the configuration file if present. + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. // +#ifdef _WIN32_WCE + string config = "config.txt"; +#else + string config = "config"; +#endif try { - properties->load("config"); + properties->load(config); } - catch(const Ice::FileException&) + catch(const FileException&) { } + communicator = Ice::initializeWithProperties(argc, 0, properties);
}
catch(const Ice::Exception& ex)
diff --git a/cppe/demo/IceE/MFC/server/HelloServer.cpp b/cppe/demo/IceE/MFC/server/HelloServer.cpp index 266fcd203ac..8183b68a575 100644 --- a/cppe/demo/IceE/MFC/server/HelloServer.cpp +++ b/cppe/demo/IceE/MFC/server/HelloServer.cpp @@ -59,15 +59,22 @@ BOOL CHelloServerApp::InitInstance() properties->setProperty("Hello.Endpoints", "tcp -p 10000"); // - // Now, load the configuration file if present. + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. // +#ifdef _WIN32_WCE + string config = "config.txt"; +#else + string config = "config"; +#endif try { - properties->load("config"); + properties->load(config); } - catch(const Ice::FileException&) + catch(const FileException&) { } + communicator = Ice::initializeWithProperties(argc, 0, properties);
log = new LogI;
communicator->setLogger(log);
diff --git a/cppe/demo/IceE/chat/ChatClientDlg.cpp b/cppe/demo/IceE/chat/ChatClientDlg.cpp index 70f52817570..28aea033ec8 100644 --- a/cppe/demo/IceE/chat/ChatClientDlg.cpp +++ b/cppe/demo/IceE/chat/ChatClientDlg.cpp @@ -109,6 +109,10 @@ END_MESSAGE_MAP() void CChatClientDlg::setDialogState() { + CWnd* sendWnd = GetDlgItem(IDC_SEND); + CWnd* configWnd = GetDlgItem(IDC_CONFIG); + CWnd* loginWnd = GetDlgItem(IDC_LOGIN); + if(_chat == 0) { // @@ -116,24 +120,24 @@ CChatClientDlg::setDialogState() // _edit->EnableWindow(FALSE); _display->EnableWindow(FALSE); - ((CButton*)GetDlgItem(IDC_SEND))->EnableWindow(FALSE); + sendWnd->EnableWindow(FALSE); #ifdef _WIN32_WCE - ((CButton*)GetDlgItem(IDC_CONFIG))->SetWindowText(L"Login"); + configWnd->SetWindowText(L"Login"); #else - ((CButton*)GetDlgItem(IDC_CONFIG))->SetWindowText("Login"); + configWnd->SetWindowText("Login"); #endif // // Set the focus to the login button // - ((CButton*)GetDlgItem(IDC_LOGIN))->SetFocus(); + loginWnd->SetFocus(); // // Set the default button. // - ::SendMessage(GetDlgItem(IDC_SEND)->m_hWnd, BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE); - ::SendMessage(m_hWnd, DM_SETDEFID, (WPARAM)IDC_CONFIG, 0); - ::SendMessage(GetDlgItem(IDC_CONFIG)->m_hWnd, BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE); + sendWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE); + SendMessage(DM_SETDEFID, (WPARAM)IDC_CONFIG, 0); + configWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE); } else { @@ -142,20 +146,20 @@ CChatClientDlg::setDialogState() // _edit->EnableWindow(TRUE); _display->EnableWindow(TRUE); - ((CButton*)GetDlgItem(IDC_SEND))->EnableWindow(TRUE); + sendWnd->EnableWindow(TRUE); #ifdef _WIN32_WCE - ((CButton*)GetDlgItem(IDC_CONFIG))->SetWindowText(L"Logout"); + configWnd->SetWindowText(L"Logout"); #else - ((CButton*)GetDlgItem(IDC_CONFIG))->SetWindowText("Logout"); + configWnd->SetWindowText("Logout"); #endif - ((CEdit*)GetDlgItem(IDC_LOG))->SetFocus();
-
- //
- // Set the default button.
- //
- ::SendMessage(GetDlgItem(IDC_CONFIG)->m_hWnd, BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE);
- ::SendMessage(m_hWnd, DM_SETDEFID, (WPARAM)IDC_SEND, 0);
- ::SendMessage(GetDlgItem(IDC_SEND)->m_hWnd, BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE); + _edit->SetFocus(); + + // + // Set the default button. + // + configWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE); + SendMessage(DM_SETDEFID, (WPARAM)IDC_SEND, 0); + sendWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE); } } diff --git a/cppe/demo/IceE/latency/Client.cpp b/cppe/demo/IceE/latency/Client.cpp index 8e2bc3a7f63..55cf2fd740d 100644 --- a/cppe/demo/IceE/latency/Client.cpp +++ b/cppe/demo/IceE/latency/Client.cpp @@ -17,7 +17,7 @@ int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { Ice::PropertiesPtr properties = communicator->getProperties(); - const char* proxyProperty = "Latency.Ping"; + const char* proxyProperty = "Latency.Proxy"; string proxy = properties->getProperty(proxyProperty); if(proxy.empty()) { diff --git a/cppe/demo/IceE/latency/WinCEClient.cpp b/cppe/demo/IceE/latency/WinCEClient.cpp index 8703f296763..b82339e947f 100755 --- a/cppe/demo/IceE/latency/WinCEClient.cpp +++ b/cppe/demo/IceE/latency/WinCEClient.cpp @@ -112,30 +112,28 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd Ice::PropertiesPtr properties = Ice::createProperties(); // - // Set a default value for Hello.Proxy so that the demo will + // Set a default value for Latency.Proxy so that the demo will // run without a configuration file. // - properties->setProperty("Latency.Ping", "ping:tcp -p 10000"); + properties->setProperty("Latency.Proxy", "ping:tcp -p 10000"); // - // Now, load the configuration file if present. + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. // try { - properties->load("config"); + properties->load("config.txt"); } catch(const Ice::FileException&) { } + communicator = Ice::initializeWithProperties(__argc, __argv, properties); - const char* proxyProperty = "Latency.Ping"; + const char* proxyProperty = "Latency.Proxy"; string proxy = properties->getProperty(proxyProperty); - // - // We use a fixed string so that the demo will run without a - // configuration file. - // PingPrx ping = PingPrx::checkedCast(communicator->stringToProxy(proxy)); if(!ping) { diff --git a/cppe/demo/IceE/latency/WinCEServer.cpp b/cppe/demo/IceE/latency/WinCEServer.cpp index 371e591106c..4fb312359f4 100755 --- a/cppe/demo/IceE/latency/WinCEServer.cpp +++ b/cppe/demo/IceE/latency/WinCEServer.cpp @@ -97,8 +97,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd height = 200; } HWND mainWnd = CreateWindow(windowClassName, L"Latency Server", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX, - CW_USEDEFAULT, CW_USEDEFAULT, width, height, - NULL, NULL, hInstance, NULL); + CW_USEDEFAULT, CW_USEDEFAULT, width, height, + NULL, NULL, hInstance, NULL); if(mainWnd == NULL) { MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); @@ -125,11 +125,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd properties->setProperty("Latency.Endpoints","tcp -p 10000"); // - // Now, load the configuration file if present. + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. // try { - properties->load("config"); + properties->load("config.txt"); } catch(const Ice::FileException&) { diff --git a/cppe/demo/IceE/latency/config b/cppe/demo/IceE/latency/config index 7b581626fb8..2ca249536b6 100644 --- a/cppe/demo/IceE/latency/config +++ b/cppe/demo/IceE/latency/config @@ -1,2 +1,2 @@ -Latency.Ping=ping:default -p 10000 +Latency.Proxy=ping:default -p 10000 Latency.Endpoints=default -p 10000 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); diff --git a/cppe/demo/IceE/minimal/WinCEServer.cpp b/cppe/demo/IceE/minimal/WinCEServer.cpp index 18e8ee627e6..82238fdd381 100644 --- a/cppe/demo/IceE/minimal/WinCEServer.cpp +++ b/cppe/demo/IceE/minimal/WinCEServer.cpp @@ -153,6 +153,18 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd // properties->setProperty("Hello.Endpoints","tcp -p 10000"); + // + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. + // + try + { + properties->load("config.txt"); + } + catch(const Ice::FileException&) + { + } + communicator = Ice::initializeWithProperties(__argc, __argv, properties); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello"); diff --git a/cppe/demo/IceE/throughput/Client.cpp b/cppe/demo/IceE/throughput/Client.cpp index fbef5415e4d..6f9a895a1d6 100644 --- a/cppe/demo/IceE/throughput/Client.cpp +++ b/cppe/demo/IceE/throughput/Client.cpp @@ -53,7 +53,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) } Ice::PropertiesPtr properties = communicator->getProperties(); - const char* proxyProperty = "Throughput.Throughput"; + const char* proxyProperty = "Throughput.Proxy"; std::string proxy = properties->getProperty(proxyProperty); if(proxy.empty()) { diff --git a/cppe/demo/IceE/throughput/WinCEClient.cpp b/cppe/demo/IceE/throughput/WinCEClient.cpp index 6a5bbefb987..47f9f763083 100755 --- a/cppe/demo/IceE/throughput/WinCEClient.cpp +++ b/cppe/demo/IceE/throughput/WinCEClient.cpp @@ -112,30 +112,28 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd Ice::PropertiesPtr properties = Ice::createProperties(); // - // Set a default value for Hello.Proxy so that the demo will + // Set a default value for Throughput.Proxy so that the demo will // run without a configuration file. // - properties->setProperty("Throughput.Throughput", "throughput:tcp -p 10000"); + properties->setProperty("Throughput.Proxy", "throughput:tcp -p 10000"); // - // Now, load the configuration file if present. + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. // try { - properties->load("config"); + properties->load("config.txt"); } catch(const Ice::FileException&) { } + communicator = Ice::initializeWithProperties(__argc, __argv, properties); - const char* proxyProperty = "Throughput.Throughput"; + const char* proxyProperty = "Throughput.Proxy"; string proxy = properties->getProperty(proxyProperty); - // - // We use a fixed string so that the demo will run without a - // configuration file. - // ThroughputPrx throughput = ThroughputPrx::checkedCast(communicator->stringToProxy(proxy)); if(!throughput) { @@ -204,7 +202,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd data = L"fixed-length struct"; seqSize = FixedSeqSize / reduce; } - for(int mode = 0; mode < 4; ++mode) { @@ -227,7 +224,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd { action = L"sending and receiving"; } - wchar_t buf[1000]; wsprintf(buf, L"\r\n%s %d %s sequences of size %d%s\r\n", action, repetitions, data, seqSize, diff --git a/cppe/demo/IceE/throughput/WinCEServer.cpp b/cppe/demo/IceE/throughput/WinCEServer.cpp index 4985806763f..6a318ee5574 100755 --- a/cppe/demo/IceE/throughput/WinCEServer.cpp +++ b/cppe/demo/IceE/throughput/WinCEServer.cpp @@ -25,7 +25,7 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT rcClient; GetClientRect(hWnd, &rcClient); editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"", - WS_CHILD | WS_VISIBLE | WS_VSCROLL /*| WS_HSCROLL*/ | ES_MULTILINE, + WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hWnd, (HMENU)101, GetModuleHandle(NULL), NULL); assert(editHwnd != NULL); @@ -91,8 +91,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd height = 200; } HWND mainWnd = CreateWindow(windowClassName, L"Throughput Server", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX, - CW_USEDEFAULT, CW_USEDEFAULT, width, height, - NULL, NULL, hInstance, NULL); + CW_USEDEFAULT, CW_USEDEFAULT, width, height, + NULL, NULL, hInstance, NULL); if(mainWnd == NULL) { MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); @@ -112,6 +112,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd try { Ice::PropertiesPtr properties = Ice::createProperties(); + // // Set a default value for Latency.Endpoints so that the demo // will run without a configuration file. @@ -119,11 +120,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd properties->setProperty("Throughput.Endpoints","tcp -p 10000"); // - // Now, load the configuration file if present. + // Now, load the configuration file if present. Under WinCE we + // use "config.txt" since it can be edited with pocket word. // try { - properties->load("config"); + properties->load("config.txt"); } catch(const Ice::FileException&) { diff --git a/cppe/demo/IceE/throughput/config b/cppe/demo/IceE/throughput/config index 612d9e33783..a20e22348f3 100644 --- a/cppe/demo/IceE/throughput/config +++ b/cppe/demo/IceE/throughput/config @@ -1,2 +1,2 @@ -Throughput.Throughput=throughput:default -p 10000 +Throughput.Proxy=throughput:default -p 10000 Throughput.Endpoints=default -p 10000 |