+#if wxUSE_IPC
+
+// connect to the given server via DDE and ask it to execute the command
+static bool wxExecuteDDE(const wxString& ddeServer,
+ const wxString& ddeTopic,
+ const wxString& ddeCommand)
+{
+ bool ok;
+
+ wxDDEClient client;
+ wxConnectionBase *conn = client.MakeConnection(_T(""),
+ ddeServer,
+ ddeTopic);
+ if ( !conn )
+ {
+ ok = FALSE;
+ }
+ else // connected to DDE server
+ {
+ // the added complication here is that although most
+ // programs use XTYP_EXECUTE for their DDE API, some
+ // important ones - like IE and other MS stuff - use
+ // XTYP_REQUEST!
+ //
+ // so we try it first and then the other one if it
+ // failed
+ {
+ wxLogNull noErrors;
+ ok = conn->Request(ddeCommand) != NULL;
+ }
+
+ if ( !ok )
+ {
+ // now try execute - but show the errors
+ ok = conn->Execute(ddeCommand);
+ }
+ }
+
+ return ok;
+}
+
+#endif // wxUSE_IPC
+