]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/dde.h
fixed wxALL_FILES definition in Unicode build
[wxWidgets.git] / include / wx / msw / dde.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dde.h
3// Purpose: DDE class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
b814b812 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_DDE_H_
13#define _WX_DDE_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "dde.h"
17#endif
18
19#include "wx/ipcbase.h"
20
21/*
22 * Mini-DDE implementation
23
24 Most transactions involve a topic name and an item name (choose these
25 as befits your application).
26
27 A client can:
28
29 - ask the server to execute commands (data) associated with a topic
30 - request data from server by topic and item
31 - poke data into the server
32 - ask the server to start an advice loop on topic/item
33 - ask the server to stop an advice loop
34
35 A server can:
36
37 - respond to execute, request, poke and advice start/stop
38 - send advise data to client
39
40 Note that this limits the server in the ways it can send data to the
41 client, i.e. it can't send unsolicited information.
42 *
43 */
44
45class WXDLLEXPORT wxDDEServer;
46class WXDLLEXPORT wxDDEClient;
47
48class WXDLLEXPORT wxDDEConnection: public wxConnectionBase
49{
50 DECLARE_DYNAMIC_CLASS(wxDDEConnection)
b3324be2 51public:
d38e8d5f 52 wxDDEConnection(wxChar *buffer, int size); // use external buffer
b814b812 53 wxDDEConnection(); // use internal buffer
2bda0e17
KB
54 ~wxDDEConnection(void);
55
56 // Calls that CLIENT can make
e90c1d2a 57 virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
d38e8d5f 58 virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
32c1cda2 59 virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
2bda0e17
KB
60 virtual bool StartAdvise(const wxString& item);
61 virtual bool StopAdvise(const wxString& item);
62
63 // Calls that SERVER can make
32c1cda2 64 virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
2bda0e17
KB
65
66 // Calls that both can make
67 virtual bool Disconnect(void);
68
2bda0e17
KB
69 // Default behaviour is to delete connection and return TRUE
70 virtual bool OnDisconnect(void);
b3324be2
JS
71
72 public:
b3324be2 73 wxString m_topicName;
b3324be2
JS
74 wxDDEServer* m_server;
75 wxDDEClient* m_client;
76
77 WXHCONV m_hConv;
32c1cda2 78 wxChar* m_sendingData;
b3324be2 79 int m_dataSize;
0d2a2b60 80 wxIPCFormat m_dataType;
2bda0e17
KB
81};
82
83class WXDLLEXPORT wxDDEServer: public wxServerBase
84{
85 DECLARE_DYNAMIC_CLASS(wxDDEServer)
86 public:
87
88 wxDDEServer(void);
89 ~wxDDEServer(void);
90 bool Create(const wxString& server_name); // Returns FALSE if can't create server (e.g. port
91 // number is already in use)
92 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic);
93
94 ////////////////////////////////////////////////////////////
95 // Implementation
96
97 // Find/delete wxDDEConnection corresponding to the HCONV
98 wxDDEConnection *FindConnection(WXHCONV conv);
99 bool DeleteConnection(WXHCONV conv);
b3324be2
JS
100 inline wxString& GetServiceName(void) const { return (wxString&) m_serviceName; }
101 inline wxList& GetConnections(void) const { return (wxList&) m_connections; }
2bda0e17
KB
102
103 protected:
b3324be2
JS
104 int m_lastError;
105 wxString m_serviceName;
106 wxList m_connections;
2bda0e17
KB
107};
108
109class WXDLLEXPORT wxDDEClient: public wxClientBase
110{
111 DECLARE_DYNAMIC_CLASS(wxDDEClient)
112 public:
113 wxDDEClient(void);
114 ~wxDDEClient(void);
115 bool ValidHost(const wxString& host);
116 virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic);
117 // Call this to make a connection.
118 // Returns NULL if cannot.
119 virtual wxConnectionBase *OnMakeConnection(void); // Tailor this to return own connection.
120
121 ////////////////////////////////////////////////////////////
122 // Implementation
123
124 // Find/delete wxDDEConnection corresponding to the HCONV
125 wxDDEConnection *FindConnection(WXHCONV conv);
126 bool DeleteConnection(WXHCONV conv);
b3324be2 127 inline wxList& GetConnections(void) const { return (wxList&) m_connections; }
2bda0e17
KB
128
129 protected:
b3324be2
JS
130 int m_lastError;
131 wxList m_connections;
2bda0e17
KB
132};
133
134void WXDLLEXPORT wxDDEInitialize();
135void WXDLLEXPORT wxDDECleanUp();
136
2bda0e17 137#endif
bbcdf8bc 138 // _WX_DDE_H_