]> git.saurik.com Git - wxWidgets.git/commitdiff
Small change for updated wxTCPXXX classes
authorGuillermo Rodriguez Garcia <guille@iies.es>
Thu, 6 Jan 2000 01:21:26 +0000 (01:21 +0000)
committerGuillermo Rodriguez Garcia <guille@iies.es>
Thu, 6 Jan 2000 01:21:26 +0000 (01:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/dde/client.cpp
samples/dde/server.cpp

index 1422e850cb97dcd7f9b0bfd141e5d6d8d6f74477..616ef99d80f091ae9611d5972f6f638c498ba036 100644 (file)
@@ -79,7 +79,12 @@ bool MyApp::OnInit()
   frame->Fit();
 
   wxString server = "4242";
+
+#if wxUSE_DDE_FOR_SAMPLE
   wxString hostName = wxGetHostName();
+#else
+  wxString hostName = "localhost";
+#endif
 
   if (argc > 1)
     server = argv[1];
@@ -99,7 +104,8 @@ bool MyApp::OnInit()
 #endif
     return FALSE;
   }
-  the_connection->StartAdvise("Item");
+  if (!the_connection->StartAdvise("Item"))
+    wxMessageBox("StartAdvise failed", "Client Demo Error");
 
   frame->Show(TRUE);
 
@@ -132,13 +138,15 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, cons
 void MyFrame::OnExecute(wxCommandEvent& event)
 {
       if (the_connection)
-        the_connection->Execute("Hello from the client!");
+        if (!the_connection->Execute("Hello from the client!"))
+          wxMessageBox("Execute failed", "Client Demo Error");
 }
 
 void MyFrame::OnPoke(wxCommandEvent& event)
 {
       if (the_connection)
-        the_connection->Poke("An item", "Some data to poke at the server!");
+        if (!the_connection->Poke("An item", "Some data to poke at the server!"))
+          wxMessageBox("Poke failed", "Client Demo Error");
 }
 
 void MyFrame::OnRequest(wxCommandEvent& event)
@@ -148,6 +156,8 @@ void MyFrame::OnRequest(wxCommandEvent& event)
         char *data = the_connection->Request("An item");
         if (data)
           wxMessageBox(data, "Client: Request", wxOK);
+        else
+          wxMessageBox("Request failed", "Client Demo Error");
       }
 }
 
index 864c68afa7fce9841037b32a729d588e983719e9..3dfb36562fed1c6fda1073d85b86d17302210622 100644 (file)
@@ -81,7 +81,6 @@ bool MyApp::OnInit()
   // Create a new server
   my_server = new MyServer;
   my_server->Create(server_name);
-
   frame->Show(TRUE);
 
   return TRUE;
@@ -164,8 +163,11 @@ MyConnection::MyConnection(char *buf, int size):wxConnection(buf, size)
 
 MyConnection::~MyConnection(void)
 {
-  dialog->Destroy();
-  the_connection = NULL;
+  if (the_connection)
+  {
+    dialog->Destroy();
+    the_connection = NULL;
+  }
 }
 
 bool MyConnection::OnExecute(const wxString& topic, char *data, int size, wxIPCFormat format)
@@ -191,6 +193,6 @@ char *MyConnection::OnRequest(const wxString& topic, const wxString& item, int *
 
 bool MyConnection::OnStartAdvise(const wxString& topic, const wxString& item)
 {
-    return TRUE;
+  return TRUE;
 }