Version: 3.1.0
wxDDEConnection Class Reference

#include <wx/dde.h>

+ Inheritance diagram for wxDDEConnection:

Detailed Description

A 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.

Library:  wxBase
Category:  Interprocess Communication
Availability:  only available for the wxMSW port.
See Also
wxConnectionBase, wxDDEClient, wxDDEServer, Interprocess Communication

Public Member Functions

 wxDDEConnection ()
 Constructs a connection object.
 
 wxDDEConnection (void *buffer, size_t size)
 Constructs a connection object.
 
bool Disconnect ()
 Called by the client or server application to disconnect from the other program; it causes the OnDisconnect() message to be sent to the corresponding connection object in the other program.
 
virtual bool OnAdvise (const wxString &topic, const wxString &item, const void *data, size_t 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.
 
virtual bool OnDisconnect ()
 Message sent to the client or server application when the other application notifies it to delete the connection.
 
virtual bool OnExecute (const wxString &topic, const void *data, size_t size, wxIPCFormat format)
 Message sent to the server application when the client notifies it to execute the given data.
 
virtual bool OnPoke (const wxString &topic, const wxString &item, const void *data, size_t size, wxIPCFormat format)
 Message sent to the server application when the client notifies it to accept the given data.
 
virtual const void * OnRequest (const wxString &topic, const wxString &item, size_t *size, wxIPCFormat format)
 Message sent to the server application when the client calls Request().
 
virtual 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.
 
virtual 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.
 
const void * Request (const wxString &item, size_t *size, wxIPCFormat format=wxIPC_TEXT)
 Called by the client application to request data from the server.
 
bool StartAdvise (const wxString &item)
 Called by the client application to ask if an advise loop can be started with the server.
 
bool StopAdvise (const wxString &item)
 Called by the client application to ask if an advise loop can be stopped.
 
bool Advise (const wxString &item, const void *data, size_t size, wxIPCFormat format=wxIPC_PRIVATE)
 Called by the server application to advise the client of a change in the data associated with the given item.
 
bool Advise (const wxString &item, const char *data)
 Called by the server application to advise the client of a change in the data associated with the given item.
 
bool Advise (const wxString &item, const wchar_t *data)
 Called by the server application to advise the client of a change in the data associated with the given item.
 
bool Advise (const wxString &item, const wxString data)
 Called by the server application to advise the client of a change in the data associated with the given item.
 
bool Execute (const void *data, size_t size, wxIPCFormat format=wxIPC_PRIVATE)
 Called by the client application to execute a command on the server.
 
bool Execute (const char *data)
 Called by the client application to execute a command on the server.
 
bool Execute (const wchar_t *data)
 Called by the client application to execute a command on the server.
 
bool Execute (const wxString data)
 Called by the client application to execute a command on the server.
 
bool Poke (const wxString &item, const void *data, size_t size, wxIPCFormat format=wxIPC_PRIVATE)
 Called by the client application to poke data into the server.
 
bool Poke (const wxString &item, const char *data)
 Called by the client application to poke data into the server.
 
bool Poke (const wxString &item, const wchar_t *data)
 Called by the client application to poke data into the server.
 
bool Poke (const wxString &item, const wxString data)
 Called by the client application to poke data into the server.
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object.
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data.
 

Constructor & Destructor Documentation

wxDDEConnection::wxDDEConnection ( )

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.

A default buffer will be associated with this connection.

wxDDEConnection::wxDDEConnection ( void *  buffer,
size_t  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.

Parameters
bufferBuffer for this connection object to use in transactions.
sizeSize of the buffer given.

Member Function Documentation

bool wxDDEConnection::Advise ( const wxString item,
const void *  data,
size_t  size,
wxIPCFormat  format = wxIPC_PRIVATE 
)

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 OnAdvise() member to be called.

Returns
true if successful.
bool wxDDEConnection::Advise ( const wxString item,
const char *  data 
)

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 OnAdvise() member to be called.

Returns
true if successful.
bool wxDDEConnection::Advise ( const wxString item,
const wchar_t *  data 
)

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 OnAdvise() member to be called.

Returns
true if successful.
bool wxDDEConnection::Advise ( const wxString item,
const wxString  data 
)

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 OnAdvise() member to be called.

Returns
true if successful.
bool wxDDEConnection::Disconnect ( )

Called by the client or server application to disconnect from the other program; it causes the 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.
bool wxDDEConnection::Execute ( const void *  data,
size_t  size,
wxIPCFormat  format = wxIPC_PRIVATE 
)

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 Poke() in that respect). Causes the server connection's OnExecute() member to be called.

Returns
true if successful.
bool wxDDEConnection::Execute ( const char *  data)

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 Poke() in that respect). Causes the server connection's OnExecute() member to be called.

Returns
true if successful.
bool wxDDEConnection::Execute ( const wchar_t *  data)

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 Poke() in that respect). Causes the server connection's OnExecute() member to be called.

Returns
true if successful.
bool wxDDEConnection::Execute ( const wxString  data)

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 Poke() in that respect). Causes the server connection's OnExecute() member to be called.

Returns
true if successful.
virtual bool wxDDEConnection::OnAdvise ( const wxString topic,
const wxString item,
const void *  data,
size_t  size,
wxIPCFormat  format 
)
virtual

Message sent to the client application when the server notifies it of a change in the data associated with the given item.

virtual bool wxDDEConnection::OnDisconnect ( )
virtual

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.

virtual bool wxDDEConnection::OnExecute ( const wxString topic,
const void *  data,
size_t  size,
wxIPCFormat  format 
)
virtual

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.

virtual bool wxDDEConnection::OnPoke ( const wxString topic,
const wxString item,
const void *  data,
size_t  size,
wxIPCFormat  format 
)
virtual

Message sent to the server application when the client notifies it to accept the given data.

virtual const void* wxDDEConnection::OnRequest ( const wxString topic,
const wxString item,
size_t *  size,
wxIPCFormat  format 
)
virtual

Message sent to the server application when the client calls Request().

The server should respond by returning a character string from OnRequest(), or NULL to indicate no data.

virtual bool wxDDEConnection::OnStartAdvise ( const wxString topic,
const wxString item 
)
virtual

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.

virtual bool wxDDEConnection::OnStopAdvise ( const wxString topic,
const wxString item 
)
virtual

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.

bool wxDDEConnection::Poke ( const wxString item,
const void *  data,
size_t  size,
wxIPCFormat  format = wxIPC_PRIVATE 
)

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 OnPoke() member to be called.

Returns
true if successful.
bool wxDDEConnection::Poke ( const wxString item,
const char *  data 
)

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 OnPoke() member to be called.

Returns
true if successful.
bool wxDDEConnection::Poke ( const wxString item,
const wchar_t *  data 
)

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 OnPoke() member to be called.

Returns
true if successful.
bool wxDDEConnection::Poke ( const wxString item,
const wxString  data 
)

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 OnPoke() member to be called.

Returns
true if successful.
const void* wxDDEConnection::Request ( const wxString item,
size_t *  size,
wxIPCFormat  format = wxIPC_TEXT 
)

Called by the client application to request data from the server.

Causes the server connection's OnRequest() member to be called.

Returns
A character string (actually a pointer to the connection's buffer) if successful, NULL otherwise.
bool wxDDEConnection::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 OnStartAdvise() member to be called.

Returns
true if the server okays it, false otherwise.
bool wxDDEConnection::StopAdvise ( const wxString item)

Called by the client application to ask if an advise loop can be stopped.

Causes the server connection's OnStopAdvise() member to be called.

Returns
true if the server okays it, false otherwise.