1 \section{\class{wxDDEConnection
}}\label{wxddeconnection
}
3 A wxDDEConnection object represents the connection between a client and a
4 server. It can be created by making a connection using a
\rtfsp
5 \helpref{wxDDEClient
}{wxddeclient
} object, or by the acceptance of a connection by a
\rtfsp
6 \helpref{wxDDEServer
}{wxddeserver
} object. The bulk of a DDE (Dynamic Data Exchange)
7 conversation is controlled by
8 calling members in a
{\bf wxDDEConnection
} object or by overriding its
11 An application should normally derive a new connection class from
12 wxDDEConnection, in order to override the communication event handlers
13 to do something interesting.
15 This DDE-based implementation is available on Windows only,
16 but a platform-independent, socket-based version
17 of this API is available using
\helpref{wxTCPConnection
}{wxtcpconnection
}.
19 \wxheading{Derived from
}
22 \helpref{wxObject
}{wxobject
}
24 \wxheading{Include files
}
30 \helpref{wxBase
}{librarieslist
}
34 \index{wxIPCFormat
}wxIPCFormat is defined as follows:
40 wxIPC_TEXT =
1, /* CF_TEXT */
41 wxIPC_BITMAP =
2, /* CF_BITMAP */
42 wxIPC_METAFILE =
3, /* CF_METAFILEPICT */
46 wxIPC_OEMTEXT =
7, /* CF_OEMTEXT */
47 wxIPC_DIB =
8, /* CF_DIB */
52 wxIPC_UTF16TEXT =
13, /* CF_UNICODE */
53 wxIPC_ENHMETAFILE =
14,
54 wxIPC_FILENAME =
15, /* CF_HDROP */
58 #if SIZEOF_WCHAR_T ==
2
59 wxIPC_UNICODETEXT = wxIPC_UTF16TEXT,
60 #elif SIZEOF_WCHAR_T ==
4
61 wxIPC_UNICODETEXT = wxIPC_UTF32TEXT,
69 \helpref{wxDDEClient
}{wxddeclient
},
\helpref{wxDDEServer
}{wxddeserver
},
\helpref{Interprocess communications overview
}{ipcoverview
}
71 \latexignore{\rtfignore{\wxheading{Members
}}}
73 \membersection{wxDDEConnection::wxDDEConnection
}\label{wxddeconnectionctor
}
75 \func{}{wxDDEConnection
}{\void}
77 \func{}{wxDDEConnection
}{\param{void*
}{buffer
},
\param{size
\_t}{ size
}}
79 Constructs a connection object. If no user-defined connection object is
80 to be derived from wxDDEConnection, then the constructor should not be
81 called directly, since the default connection object will be provided on
82 requesting (or accepting) a connection. However, if the user defines his
83 or her own derived connection object, the
\helpref{wxDDEServer::OnAcceptConnection
}{wxddeserveronacceptconnection
}\rtfsp
84 and/or
\helpref{wxDDEClient::OnMakeConnection
}{wxddeclientonmakeconnection
} members should be replaced by
85 functions which construct the new connection object. If the arguments of
86 the wxDDEConnection constructor are void, then a default buffer is
87 associated with the connection. Otherwise, the programmer must provide a
88 a buffer and size of the buffer for the connection object to use in
91 \membersection{wxDDEConnection::Advise
}\label{wxddeconnectionadvise
}
93 \func{bool
}{Advise
}{\param{const wxString\&
}{item
},
\param{const void*
}{data
},
\param{size
\_t }{size
},
\param{wxIPCFormat
}{format = wxIPC
\_PRIVATE}}
95 \func{bool
}{Advise
}{\param{const wxString\&
}{item
},
\param{const char*
}{data
},
\param{size
\_t }{size = (size
\_t)-
1}}
97 \func{bool
}{Advise
}{\param{const wxString\&
}{item
},
\param{const wchar
\_t*
}{data
},
\param{size
\_t }{size = (size
\_t)-
1}}
99 \func{bool
}{Advise
}{\param{const wxString\&
}{item
},
\param{const wxString&
}{data
}}
101 Called by the server application to advise the client of a change in
102 the data associated with the given item. Causes the client
103 connection's
\helpref{wxDDEConnection::OnAdvise
}{wxddeconnectiononadvise
}
104 member to be called. Returns true if successful.
106 \membersection{wxDDEConnection::Execute
}\label{wxddeconnectionexecute
}
108 \func{bool
}{Execute
}{\param{const void*
}{data
},
\param{size
\_t }{size
},
\param{wxIPCFormat
}{format = wxIPC
\_PRIVATE}}
110 \func{bool
}{Execute
}{\param{const char*
}{data
},
\param{size
\_t }{size = (size
\_t)-
1}}
112 \func{bool
}{Execute
}{\param{const wchar
\_t*
}{data
},
\param{size
\_t }{size = (size
\_t)-
1}}
114 \func{bool
}{Execute
}{\param{const wxString&
}{data
}}
116 Called by the client application to execute a command on the server. Can
117 also be used to transfer arbitrary data to the server (similar
118 to
\helpref{wxDDEConnection::Poke
}{wxddeconnectionpoke
} in that respect). Causes the
119 server connection's
\helpref{wxDDEConnection::OnExecute
}{wxddeconnectiononexecute
} member to be
120 called. Returns true if successful.
122 \membersection{wxDDEConnection::Disconnect
}\label{wxddeconnectiondisconnect
}
124 \func{bool
}{Disconnect
}{\void}
126 Called by the client or server application to disconnect from the other
127 program; it causes the
\helpref{wxDDEConnection::OnDisconnect
}{wxddeconnectionondisconnect
} message
128 to be sent to the corresponding connection object in the other
129 program. The default behaviour of
{\bf OnDisconnect
} is to delete the
130 connection, but the calling application must explicitly delete its
131 side of the connection having called
{\bf Disconnect
}. Returns true if
134 \membersection{wxDDEConnection::OnAdvise
}\label{wxddeconnectiononadvise
}
136 \func{virtual bool
}{OnAdvise
}{\param{const wxString\&
}{topic
},
\param{const wxString\&
}{item
},
\param{const void*
}{data
},
\param{size
\_t }{size
},
\param{wxIPCFormat
}{format
}}
138 Message sent to the client application when the server notifies it of a
139 change in the data associated with the given item.
141 \membersection{wxDDEConnection::OnDisconnect
}\label{wxddeconnectionondisconnect
}
143 \func{virtual bool
}{OnDisconnect
}{\void}
145 Message sent to the client or server application when the other
146 application notifies it to delete the connection. Default behaviour is
147 to delete the connection object.
149 \membersection{wxDDEConnection::OnExecute
}\label{wxddeconnectiononexecute
}
151 \func{virtual bool
}{OnExecute
}{\param{const wxString\&
}{topic
},
\param{const void*
}{data
},
\param{size
\_t }{size
},
\param{wxIPCFormat
}{ format
}}
153 Message sent to the server application when the client notifies it to
154 execute the given data. Note that there is no item associated with
157 \membersection{wxDDEConnection::OnPoke
}\label{wxddeconnectiononpoke
}
159 \func{virtual bool
}{OnPoke
}{\param{const wxString\&
}{topic
},
\param{const wxString\&
}{item
},
\param{const void*
}{data
},
\param{size
\_t }{size
},
\param{wxIPCFormat
}{format
}}
161 Message sent to the server application when the client notifies it to
162 accept the given data.
164 \membersection{wxDDEConnection::OnRequest
}\label{wxddeconnectiononrequest
}
166 \func{virtual const void*
}{OnRequest
}{\param{const wxString\&
}{topic
},
\param{const wxString\&
}{item
},
\param{size
\_t *
}{size
},
\param{wxIPCFormat
}{format
}}
168 Message sent to the server application when the client
169 calls
\helpref{wxDDEConnection::Request
}{wxddeconnectionrequest
}. The server
170 should respond by returning a character string from
{\bf OnRequest
},
171 or NULL to indicate no data.
173 \membersection{wxDDEConnection::OnStartAdvise
}\label{wxddeconnectiononstartadvise
}
175 \func{virtual bool
}{OnStartAdvise
}{\param{const wxString\&
}{topic
},
\param{const wxString\&
}{item
}}
177 Message sent to the server application by the client, when the client
178 wishes to start an `advise loop' for the given topic and item. The
179 server can refuse to participate by returning false.
181 \membersection{wxDDEConnection::OnStopAdvise
}\label{wxddeconnectiononstopadvise
}
183 \func{virtual bool
}{OnStopAdvise
}{\param{const wxString\&
}{topic
},
\param{const wxString\&
}{item
}}
185 Message sent to the server application by the client, when the client
186 wishes to stop an `advise loop' for the given topic and item. The
187 server can refuse to stop the advise loop by returning false, although
188 this doesn't have much meaning in practice.
190 \membersection{wxDDEConnection::Poke
}\label{wxddeconnectionpoke
}
192 \func{bool
}{Poke
}{\param{const wxString\&
}{item
},
\param{const void*
}{data
},
\param{size
\_t }{size
},
\param{wxIPCFormat
}{format = wxIPC
\_PRIVATE}}
194 \func{bool
}{Poke
}{\param{const wxString\&
}{item
},
\param{const char*
}{data
},
\param{size
\_t }{size = (size
\_t)-
1}}
196 \func{bool
}{Poke
}{\param{const wxString\&
}{item
},
\param{const wchar
\_t*
}{data
},
\param{size
\_t }{size = (size
\_t)-
1}}
198 \func{bool
}{Poke
}{\param{const wxString\&
}{item
},
\param{const wxString&
}{data
}}
200 Called by the client application to poke data into the server. Can be
201 used to transfer arbitrary data to the server. Causes the server
202 connection's
\helpref{wxDDEConnection::OnPoke
}{wxddeconnectiononpoke
} member
203 to be called. Returns true if successful.
205 \membersection{wxDDEConnection::Request
}\label{wxddeconnectionrequest
}
207 \func{const void*
}{Request
}{\param{const wxString\&
}{item
},
\param{size
\_t *
}{size
},
\param{wxIPCFormat
}{format = wxIPC
\_TEXT}}
209 Called by the client application to request data from the server. Causes
210 the server connection's
\helpref{wxDDEConnection::OnRequest
}{wxddeconnectiononrequest
} member to be called. Returns a
211 character string (actually a pointer to the connection's buffer) if
212 successful, NULL otherwise.
214 \membersection{wxDDEConnection::StartAdvise
}\label{wxddeconnectionstartadvise
}
216 \func{bool
}{StartAdvise
}{\param{const wxString\&
}{item
}}
218 Called by the client application to ask if an advise loop can be started
219 with the server. Causes the server connection's
\helpref{wxDDEConnection::OnStartAdvise
}{wxddeconnectiononstartadvise
}\rtfsp
220 member to be called. Returns true if the server okays it, false
223 \membersection{wxDDEConnection::StopAdvise
}\label{wxddeconnectionstopadvise
}
225 \func{bool
}{StopAdvise
}{\param{const wxString\&
}{item
}}
227 Called by the client application to ask if an advise loop can be
228 stopped. Causes the server connection's
\helpref{wxDDEConnection::OnStopAdvise
}{wxddeconnectiononstopadvise
} member
229 to be called. Returns true if the server okays it, false otherwise.