|
|
1.1 root 1: #include <windows.h>
2: #include <windowsx.h>
3: #include <ddeml.h>
4:
5: #define WINDOWMENU 3 /* position of window menu */
6:
7: /* resource ID's */
8: #define IDCLIENT 1
9: #define IDCONV 2
10: #define IDLIST 3
11:
12:
13: /* menu ID's */
14:
15: #define IDM_EDITPASTE 2004
16:
17: #define IDM_CONNECT 3000 // enabled always
18: #define IDM_RECONNECT 3001 // enabled if list selected
19: #define IDM_DISCONNECT 3002 // enabled if conversation selected
20: #define IDM_TRANSACT 3003 // enabled if conversation selected
21: #define IDM_ABANDON 3004 // enabled if transaction selected
22: #define IDM_ABANDONALL 3005 // enabled if conv. selected &&
23: // and any transaction windows exist
24:
25: #define IDM_BLOCKCURRENT 3010 // enabled if conv. sel. chkd if conv. blocked
26: #define IDM_ENABLECURRENT 3011 // enabled if conv. sel. chkd if not blocked
27: #define IDM_ENABLEONECURRENT 3012 // enabled if conv. sel.
28:
29: #define IDM_BLOCKALLCBS 3013 // enabled if any convs.
30: #define IDM_ENABLEALLCBS 3014 // enabled if any convs.
31: #define IDM_ENABLEONECB 3015 // enabled if any convs.
32:
33: #define IDM_BLOCKNEXTCB 3016 // enabled always, chkd if set.
34: #define IDM_TERMNEXTCB 3017 // enabled if any convs. chked if set.
35:
36: #define IDM_TIMEOUT 3021
37: #define IDM_DELAY 3022
38: #define IDM_CONTEXT 3023
39: #define IDM_AUTORECONNECT 3024
40:
41: #define IDM_WINDOWTILE 4001
42: #define IDM_WINDOWCASCADE 4002
43: #define IDM_WINDOWCLOSEALL 4003
44: #define IDM_WINDOWICONS 4004
45:
46: #define IDM_XACTTILE 4005
47: #define IDM_XACTCASCADE 4006
48: #define IDM_XACTCLOSEALL 4007
49:
50: #define IDM_WINDOWCHILD 4100
51:
52: #define IDM_HELP 5001
53: #define IDM_HELPABOUT 5002
54:
55:
56: #define DEFTIMEOUT 1000
57:
58: #include "dialog.h"
59:
60: // predefined format list item
61:
62: typedef struct {
63: DWORD fmt;
64: PSTR sz;
65: } FORMATINFO;
66: #define CFORMATS 3
67:
68: // conversation (MDI child) window information
69: typedef struct {
70: HWND hwndXaction; // last xaction window with focus, 0 if none.
71: BOOL fList;
72: HCONV hConv;
73: HSZ hszTopic;
74: HSZ hszApp;
75: INT x; // next child coord.
76: INT y;
77: CONVINFO ci; // most recent status info.
78: } MYCONVINFO; // parameters to AddConv() in reverse order.
79: #define CHILDCBWNDEXTRA sizeof(HWND)
80: #define UM_GETNEXTCHILDX (WM_USER + 200)
81: #define UM_GETNEXTCHILDY (WM_USER + 201)
82: #define UM_DISCONNECTED (WM_USER + 202)
83:
84: // transaction processing structure - this structure is associated with
85: // infoctrl control windows. A handle to this structure is placed into
86: // the first window word of the control.
87: typedef struct { // used to passinfo to/from TransactionDlgProc and
88: DWORD ret; // TextEntryDlgProc.
89: DWORD Result;
90: DWORD ulTimeout;
91: DWORD wType;
92: HCONV hConv;
93: HDDEDATA hDdeData;
94: DWORD wFmt;
95: HSZ hszItem;
96: DWORD fsOptions;
97: } XACT;
98:
99: typedef struct {
100: HDDEDATA hData;
101: HSZ hszItem;
102: DWORD wFmt;
103: } OWNED;
104:
105: // transaction option flags - for fsOptions field and DefOptions global.
106:
107: #define XOPT_NODATA 0x0001
108: #define XOPT_ACKREQ 0x0002
109: #define XOPT_DISABLEFIRST 0x0004
110: #define XOPT_ABANDONAFTERSTART 0x0008
111: #define XOPT_BLOCKRESULT 0x0010
112: #define XOPT_ASYNC 0x0020
113: #define XOPT_COMPLETED 0x8000 // used internally only.
114:
115: /* strings */
116: #define IDS_ILLFNM 1
117: #define IDS_ADDEXT 2
118: #define IDS_CLOSESAVE 3
119: #define IDS_HELPNOTAVAIL 4
120: #define IDS_CLIENTTITLE 5
121: #define IDS_APPNAME 6
122: #define IDS_DDEMLERR 7
123: #define IDS_BADLENGTH 8
124:
125: /* attribute flags for DlgDirList */
126: #define ATTR_DIRS 0xC010 /* find drives and directories */
127: #define ATTR_FILES 0x0000 /* find ordinary files */
128: #define PROP_FILENAME szPropertyName /* name of property for dialog */
129: #define MAX_OWNED 20
130:
131: /*
132: * GLOBALS
133: */
134: extern CONVCONTEXT CCFilter;
135: extern DWORD idInst;
136: extern HANDLE hInst; /* application instance handle */
137: extern HANDLE hAccel; /* resource handle of accelerators */
138: extern HWND hwndFrame; /* main window handle */
139: extern HWND hwndMDIClient; /* handle of MDI Client window */
140: extern HWND hwndActive; /* handle of current active MDI child */
141: extern HWND hwndActiveEdit; /* handle of edit control in active child */
142: extern LONG styleDefault; /* default child creation state */
143: extern DWORD SyncTimeout;
144: extern LONG DefTimeout;
145: extern DWORD wDelay;
146: extern BOOL fEnableCBs;
147: extern BOOL fEnableOneCB;
148: extern BOOL fBlockNextCB;
149: extern BOOL fTermNextCB;
150: extern BOOL fAutoReconnect;
151: extern HDDEDATA hDataOwned;
152: extern DWORD fmtLink; // registered LINK clipboard fmt
153: extern DWORD DefOptions;
154: extern CHAR szChild[]; /* class of child */
155: extern CHAR szList[]; /* class of child */
156: extern CHAR szSearch[]; /* search string */
157: extern CHAR *szDriver; /* name of printer driver */
158: extern CHAR szPropertyName[]; /* filename property for dialog box */
159: extern INT iPrinter; /* level of printing capability */
160: extern BOOL fCase; /* searches case sensitive */
161: extern DWORD cFonts; /* number of fonts enumerated */
162: extern FORMATINFO aFormats[];
163: extern OWNED aOwned[MAX_OWNED];
164: extern DWORD cOwned;
165: extern FARPROC lpMsgFilterProc;
166:
167:
168: // MACROS
169:
170: #ifdef NODEBUG
171: #define MyAlloc(cb) (PSTR)LocalAlloc(LPTR, (cb))
172: #define MyFree(p) (LocalUnlock((HANDLE)(p)), LocalFree((HANDLE)(p)))
173: #else // DEBUG
174:
175: #define MyAlloc(cb) DbgAlloc((DWORD)cb)
176: #define MyFree(p) DbgFree((PSTR)p)
177: #endif //NODEBUG
178:
179:
180: /* externally declared functions
181: */
182:
183: // client.c
184:
185: BOOL APIENTRY InitializeApplication(VOID);
186: BOOL APIENTRY InitializeInstance(DWORD);
187: HWND APIENTRY AddFile(CHAR *);
188: VOID APIENTRY MyReadFile(HWND);
189: VOID APIENTRY SaveFile(HWND);
190: BOOL APIENTRY ChangeFile(HWND);
191: INT APIENTRY LoadFile(HWND, CHAR *);
192: VOID APIENTRY PrintFile(HWND);
193: BOOL APIENTRY GetInitializationData(HWND);
194: INT FAR cdecl MPError(DWORD,DWORD,...);
195: VOID APIENTRY Find(VOID);
196: VOID APIENTRY FindNext(VOID);
197: VOID APIENTRY FindPrev(VOID);
198: LONG APIENTRY FrameWndProc(HWND, UINT, WPARAM, LPARAM);
199: LONG APIENTRY MDIChildWndProc(HWND, UINT, WPARAM, LPARAM);
200: HDC APIENTRY GetPrinterDC(VOID);
201: VOID NEAR PASCAL SetSaveFrom (HWND, PSTR);
202: BOOL NEAR PASCAL RealSlowCompare (PSTR, PSTR);
203: VOID APIENTRY FindPrev (VOID);
204: VOID APIENTRY FindNext (VOID);
205: BOOL NEAR PASCAL IsWild (PSTR);
206: VOID NEAR PASCAL SelectFile (HWND);
207: HCONV CreateConv(HSZ hszApp, HSZ hszTopic, BOOL fList);
208: HWND APIENTRY AddConv(HSZ hszApp, HSZ hszTopic, HCONV hConv, BOOL fList);
209: PSTR GetConvListText(HCONVLIST hConvList);
210: PSTR GetConvInfoText(HCONV hConv, CONVINFO *pci);
211: PSTR GetConvTitleText(HCONV hConv, HSZ hszApp, HSZ hszTopic, BOOL fList);
212: PSTR Status2String(DWORD status);
213: PSTR State2String(DWORD state);
214: PSTR Error2String(DWORD error);
215: PSTR Type2String(DWORD wType, DWORD fsOptions);
216: PSTR GetHSZName(HSZ hsz);
217: DWORD APIENTRY MyMsgFilterProc(INT nCode, WPARAM wParam, DWORD lParam);
218:
219: // dialog.c
220:
221:
222: INT FAR DoDialog(LPSTR lpTemplateName, WNDPROC lpDlgProc, LONG param,
223: BOOL fRememberFocus);
224: BOOL APIENTRY AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
225: BOOL APIENTRY ConnectDlgProc(HWND, UINT, WPARAM, LPARAM);
226: BOOL APIENTRY TransactDlgProc(HWND, UINT, WPARAM, LPARAM);
227: BOOL APIENTRY AdvOptsDlgProc(HWND, UINT, WPARAM, LPARAM);
228: BOOL APIENTRY TextEntryDlgProc(HWND, UINT, WPARAM, LPARAM);
229: BOOL APIENTRY ViewHandleDlgProc(HWND, UINT, WPARAM, LPARAM);
230: BOOL APIENTRY TimeoutDlgProc(HWND, UINT, WPARAM, LPARAM);
231: BOOL APIENTRY DelayDlgProc(HWND, UINT, WPARAM, LPARAM);
232: BOOL APIENTRY ContextDlgProc(HWND, UINT, WPARAM, LPARAM);
233: VOID Delay(DWORD delay);
234:
235: // dde.c
236:
237:
238: BOOL ProcessTransaction(XACT *pxact);
239: VOID CompleteTransaction(HWND hwndInfoCtr, XACT *pxact);
240: HDDEDATA CALLBACK DdeCallback(UINT wType, UINT wFmt, HCONV hConv, HSZ hsz1,
241: HSZ hsz2, HDDEDATA hData, DWORD lData1, DWORD lData2);
242: HWND MDIChildFromhConv(HCONV hConv);
243: HWND FindAdviseChild(HWND hwndMDI, HSZ hszItem, DWORD wFmt);
244: HWND FindListWindow(HCONVLIST hConvList);
245: PSTR GetTextData(HDDEDATA hData);
246: PSTR GetFormatData(HDDEDATA hData);
247: INT MyGetClipboardFormatName(DWORD fmt, LPSTR lpstr, INT cbMax);
248: PSTR GetFormatName(DWORD wFmt);
249: BOOL MyDisconnect(HCONV hConv);
250:
251: // mem.c
252:
253:
254: PSTR DbgAlloc(DWORD cb);
255: PSTR DbgFree(PSTR p);
256:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.