wxddeconnectiona wxddeconnection object represents the connection between a client and a server. it can be created by making a connection using a wxddeclient object, or by the acceptance of a connection by a wxddeserver object. the bulk of a dde (dynamic data exchange) conversation is controlled by calling members in a wxddeconnection object or by overriding its members. an application should normally derive a new connection class from wxddeconnection, in order to override the communication event handlers to do something interesting. this dde-based implementation is available on windows only, but a platform-independent, socket-based version of this api is available using wxtcpconnection. derived from
wxconnectionbase include files <wx/dde.h> types wxipcformat is defined as follows:
enum wxipcformat { wxipc_invalid = 0, wxipc_text = 1, /* cf_text */ wxipc_bitmap = 2, /* cf_bitmap */ wxipc_metafile = 3, /* cf_metafilepict */ wxipc_sylk = 4, wxipc_dif = 5, wxipc_tiff = 6, wxipc_oemtext = 7, /* cf_oemtext */ wxipc_dib = 8, /* cf_dib */ wxipc_palette = 9, wxipc_pendata = 10, wxipc_riff = 11, wxipc_wave = 12, wxipc_unicodetext = 13, wxipc_enhmetafile = 14, wxipc_filename = 15, /* cf_hdrop */ wxipc_locale = 16, wxipc_private = 20 };see also wxddeclient, wxddeserver, interprocess communications overview members
wxddeconnection::wxddeconnection
wxddeconnection::wxddeconnectionwxddeconnection() wxddeconnection(char* buffer, int size) constructs a connection object. if no user-defined connection object is to be derived from wxddeconnection, then the constructor should not be called directly, since the default connection object will be provided on requesting (or accepting) a connection. however, if the user defines his or her own derived connection object, the wxddeserver::onacceptconnection and/or wxddeclient::onmakeconnection members should be replaced by functions which construct the new connection object. if the arguments of the wxddeconnection constructor are void, then a default buffer is associated with the connection. otherwise, the programmer must provide a a buffer and size of the buffer for the connection object to use in transactions.
wxddeconnection::advisebool advise(const wxstring& item, char* data, int size = -1, wxipcformat format = wxcf_text) called by the server application to advise the client of a change in the data associated with the given item. causes the client connection's wxddeconnection::onadvise member to be called. returns true if successful.
wxddeconnection::executebool execute(char* data, int size = -1, wxipcformat format = wxcf_text) called by the client application to execute a command on the server. can also be used to transfer arbitrary data to the server (similar to wxddeconnection::poke in that respect). causes the server connection's wxddeconnection::onexecute member to be called. returns true if successful.
wxddeconnection::disconnectbool disconnect() called by the client or server application to disconnect from the other program; it causes the wxddeconnection::ondisconnect message to be sent to the corresponding connection object in the other program. the default behaviour of ondisconnect is to delete the connection, but the calling application must explicitly delete its side of the connection having called disconnect. returns true if successful.
wxddeconnection::onadvisevirtual bool onadvise(const wxstring& topic, const wxstring& item, char* data, int size, wxipcformat format) message sent to the client application when the server notifies it of a change in the data associated with the given item.
wxddeconnection::ondisconnectvirtual bool ondisconnect() message sent to the client or server application when the other application notifies it to delete the connection. default behaviour is to delete the connection object.
wxddeconnection::onexecutevirtual bool onexecute(const wxstring& topic, char* data, int size, wxipcformat format) message sent to the server application when the client notifies it to execute the given data. note that there is no item associated with this message.
wxddeconnection::onpokevirtual bool onpoke(const wxstring& topic, const wxstring& item, char* data, int size, wxipcformat format) message sent to the server application when the client notifies it to accept the given data.
wxddeconnection::onrequestvirtual char* onrequest(const wxstring& topic, const wxstring& item, int *size, wxipcformat format) message sent to the server application when the client calls wxddeconnection::request. the server should respond by returning a character string from onrequest, or null to indicate no data.
wxddeconnection::onstartadvisevirtual bool onstartadvise(const wxstring& topic, const wxstring& item) message sent to the server application by the client, when the client wishes to start an 'advise loop' for the given topic and item. the server can refuse to participate by returning false.
wxddeconnection::onstopadvisevirtual bool onstopadvise(const wxstring& topic, const wxstring& item) message sent to the server application by the client, when the client wishes to stop an 'advise loop' for the given topic and item. the server can refuse to stop the advise loop by returning false, although this doesn't have much meaning in practice.
wxddeconnection::pokebool poke(const wxstring& item, char* data, int size = -1, wxipcformat format = wxcf_text) called by the client application to poke data into the server. can be used to transfer arbitrary data to the server. causes the server connection's wxddeconnection::onpoke member to be called. returns true if successful.
wxddeconnection::requestchar* request(const wxstring& item, int *size, wxipcformat format = wxipc_text) called by the client application to request data from the server. causes the server connection's wxddeconnection::onrequest member to be called. returns a character string (actually a pointer to the connection's buffer) if successful, null otherwise.
wxddeconnection::startadvisebool startadvise(const wxstring& item) called by the client application to ask if an advise loop can be started with the server. causes the server connection's wxddeconnection::onstartadvise member to be called. returns true if the server okays it, false otherwise.
wxddeconnection::stopadvisebool stopadvise(const wxstring& item) called by the client application to ask if an advise loop can be stopped. causes the server connection's wxddeconnection::onstopadvise member to be called. returns true if the server okays it, false otherwise.
|