|
|
1.1 root 1:
2: /******************************************************************************\
3: * This is a part of the Microsoft Source Code Samples.
4: * Copyright (C) 1993 Microsoft Corporation.
5: * All rights reserved.
6: * This source code is only intended as a supplement to
7: * Microsoft Development Tools and/or WinHelp documentation.
8: * See these sources for detailed information regarding the
9: * Microsoft samples programs.
10: \******************************************************************************/
11:
12: #include <windows.h>
13: #include <commdlg.h>
14: #include <string.h>
15: #include <stdlib.h>
16:
17: #ifdef RC_INVOKED
18: #define ID(id) id
19: #else
20: #define ID(id) MAKEINTRESOURCE(id)
21: #endif
22:
23: #undef EDIT_FIXED
24:
25: // resource ID's
26: #define IDPortTool ID(1)
27: #define IDBkPort ID(2)
28:
29: #define IDA_PORTTOOL 1
30:
31: // edit control child window ID
32: #define IDC_EDIT 1000
33:
34: // max string lengths
35: #define MAXSEARCHSTRING 80
36: #define MAXPTRDEFINITION 200
37: #define MAXPTRDEVICE 50
38: #define MAXPTRDRIVER 50
39: #define MAXPTRPORT 50
40:
41: // extra byte window word and long definitions
42: #define WL_HWNDEDIT 0
43: #define WW_SCROLL 4
44: #define WW_UNTITLED 6
45: #define WW_SEARCHCASE 8
46: #define WW_SEARCHDN 10
47: #define WL_HPTRDEVNAMES 12
48: #define CBWNDEXTRA 16
49:
50: // menuitem IDs, file submenu
51: #define IDM_FILENEW 1001
52: #define IDM_FILEOPEN 1002
53: #define IDM_FILESAVE 1003
54: #define IDM_FILESAVEAS 1004
55: #define IDM_FILEPRINT 1005
56: #define IDM_FILESETUP 1006
57: #define IDM_FILEEXIT 1007
58: #define IDM_FILEABOUT 1008
59: // edit submenu
60: #define IDM_EDITUNDO 2000
61: #define IDM_EDITCUT 2001
62: #define IDM_EDITCOPY 2002
63: #define IDM_EDITPASTE 2003
64: #define IDM_EDITCLEAR 2004
65: #define IDM_EDITSELECT 2005
66: #define IDM_EDITWRAP 2006
67: #define IDM_EDITSCROLL 2007
68: #define IDM_EDITFONT 2008
69: // search submenu
70: #define IDM_SEARCHFIND 3001
71: #define IDM_SEARCHNEXT 3002
72: #define IDM_SEARCHPREV 3003
73: // port submenu
74: #define IDM_PORTCURFILE 4000
75: #define IDM_PORTBKGND 4001
76:
77: #define IDM_FUNCTION1 5000
78: #define IDM_FUNCTION2 5001
79: #define IDM_FUNCTION3 5002
80: #define IDM_FUNCTION4 5003
81: #define IDM_FUNCTION5 5004
82:
83: // dialog & control IDs
84:
85: // about dialog
86: #define IDD_ABOUT ID(300)
87:
88: // cancel print dialog
89: #define IDD_CANCELDLG ID(400)
90: #define IDC_PRINTDEVICE 401
91: #define IDC_PRINTPORT 402
92: #define IDC_PRINTTITLE 403
93:
94: // port options dialog
95: #define IDD_OPTIONSDLG ID(500)
96: #define IDC_NOAPIS 501
97: #define IDC_NOMESSAGES 502
98: #define IDC_NOSTRUCTURES 503
99: #define IDC_NOMACROS 504
100: #define IDC_NOCONSTANTS 505
101: #define IDC_NOTYPES 506
102: #define IDC_NOCUSTOM 507
103: #define IDC_IGNORECASE 508
104: #define IDC_CURTOKEN 509
105: #define IDC_IGNORETOKEN 510
106:
107: // port current file dialog
108: #define IDD_PORTDIALOG ID(600)
109: #define IDC_SEARCHFOUND 601
110: #define IDC_ISSUECNT 602
111: #define IDC_LINENO 603
112: #define IDC_LINE 604
113: #define IDC_ISSUE 605
114: #define IDC_CONTINUE 606
115: #define IDC_SUGGESTION 608
116: #define IDC_SUGGESTLABEL 609
117: #define IDC_OPTIONS 610
118: #define IDC_DONE 611
119: #define IDC_HELP 612
120: #define IDC_RESTART 613
121:
122: // background port status dialog
123: #define IDD_BKPORTDIALOG ID(700)
124: #define IDC_BKNOAPIS 702
125: #define IDC_BKNOMESSAGES 703
126: #define IDC_BKNOSTRUCTURES 704
127: #define IDC_BKNOMACROS 705
128: #define IDC_BKNOCONSTANTS 706
129: #define IDC_BKNOTYPES 707
130: #define IDC_BKNOCUSTOM 708
131: #define IDC_BKIGNORECASE 709
132: #define IDC_CHANGEOPTIONS 710
133: #define IDC_ADDFILE 711
134: #define IDC_COMPLETE 712
135: #define IDC_LINES 713
136: #define IDC_ISSUES 714
137: #define IDC_ABORTFILE 715
138: #define IDC_FILEPATH 716
139: #define IDC_FILELIST 717
140: #define IDC_BKDONE 718
141:
142:
143: // file I/O error stringtable entries
144: #define IDS_OPENFAILED WM_USER+101
145: #define IDS_NOSIZE WM_USER+102
146: #define IDS_READFAILED WM_USER+103
147: #define IDS_REALLOCFAILED WM_USER+104
148: #define IDS_EDITWNDFAILED WM_USER+105
149: #define IDS_GETHANDLEFAILED WM_USER+106
150: #define IDS_WRITEOPENFAILED WM_USER+107
151: #define IDS_WRITEFAILED WM_USER+108
152: #define IDS_PTRCOMMDLGFAILED WM_USER+109
153: #define IDS_PRINTABORTED WM_USER+110
154: #define IDS_STARTDOCFAILED WM_USER+111
155: #define IDS_SETABORTPROCFAILED WM_USER+112
156: #define IDS_CANCELDLGFAILED WM_USER+113
157: #define IDS_PTRCONFIGFAILED WM_USER+114
158: #define IDS_NOFILETOPORT WM_USER+115
159: #define IDS_PORTINITFAILED WM_USER+116
160: #define IDS_MEMORYFAILED WM_USER+117
161: #define IDS_FONTFAILEDTOCREATE WM_USER+118
162: #define IDS_LOADPORTFAILED WM_USER+119
163: #define IDS_PROCADDRESSFAILED WM_USER+120
164: #define IDS_UNTITLED WM_USER+201
165: #define IDS_APPNAME WM_USER+202
166: #define IDS_PRINTJOB WM_USER+203
167: #define IDS_PRINTERROR WM_USER+204
168: #define IDS_DATACHANGED WM_USER+205
169: #define IDS_DEFAULTFILEEXT WM_USER+206
170: #define IDS_SAVEASTITLE WM_USER+207
171: #define IDS_FILEOPENTITLE WM_USER+208
172: #define IDS_STRINGNOTFOUND WM_USER+209
173: #define IDS_SEARCHDLGFAILED WM_USER+210
174: #define IDS_WINDOWSAPPNAME WM_USER+211
175: #define IDS_DEVICENAME WM_USER+212
176: #define IDS_PORTFILE WM_USER+213
177: #define IDS_SEARCHING WM_USER+214
178: #define IDS_FOUND WM_USER+215
179: #define IDS_NOMOREPORTISSUES WM_USER+216
180: #define IDS_INIFILE WM_USER+217
181: #define IDS_WINHELP WM_USER+218
182: #define IDS_NOTYETIMPLEMENTED WM_USER+219
183: #define IDS_NOT WM_USER+220
184: #define IDS_PORTDLLFILE WM_USER+221
185: #define IDS_CHECKSTRING WM_USER+222
186: #define IDS_BKPORTNEWLINE WM_USER+223
187: #define IDS_BKPORTHEADER WM_USER+224
188: #define IDS_BKPORTTOKEN WM_USER+225
189: #define IDS_BKPORTISSUE WM_USER+226
190: #define IDS_BKPORTSUGGEST WM_USER+227
191: #define IDS_BKPORTHELP WM_USER+228
192: #define IDS_BKPORTHELPFILE WM_USER+229
193: #define IDS_BKPORTEOL WM_USER+230
194: #define IDS_BKPORTABORT WM_USER+231
195: #define IDS_BKPORTSTATUS WM_USER+232
196: #define IDS_BKPORTCANCEL WM_USER+233
197: #define IDS_BKPORTSTARTFAILED WM_USER+234
198: #define IDS_CANTBUILDFILELIST WM_USER+235
199:
200:
201: // define background porting handle array indexes
202: #define BKPORT_ABORT 0
203: #define BKPORT_STATUS 1
204: #define nBKPORTEVENTS 2
205:
206: #define MAXBKTHREADS 20
207:
208: // define structure used in background porting
209: typedef struct tagBkPortFile
210: {
211: char szFile[MAX_PATH];
212: char szFilePath[MAX_PATH];
213: DWORD dwPTFlags;
214: HANDLE hThread;
215: HWND hDlg;
216: }BKPORTFILESTRUCT, * LPBKPORTFILESTRUCT;
217:
218:
219: // linked list structure defines background files being ported
220: typedef struct _BKFILELIST
221: {
222: BKPORTFILESTRUCT bkFile;
223: HANDLE hEvents[nBKPORTEVENTS];
224: LPVOID Next;
225: }BKFILELIST, * LPBKFILELIST;
226:
227:
228: // function prototypes defined in PORTTOOL.C
229: #define UM_SAVEFILE WM_USER+1
230: VOID WINAPI ErrorNotify (HWND, int);
231: LONG WINAPI MainWndProc (HWND, UINT, UINT, LONG);
232: BOOL WINAPI AboutDlgProc (HWND, UINT, UINT, LONG);
233:
234: // globals and function prototypes defined in PTFILE.C
235: extern char lpszFilePath[MAX_PATH];
236: BOOL WINAPI GetFileName(HWND, char *, char *);
237: BOOL WINAPI GetFileFromPath (char *, char *);
238: BOOL WINAPI GetIniFile (char *);
239: int WINAPI SaveFile (HWND, char *);
240: BOOL WINAPI SaveAsFileName (HWND, char *, char *);
241: int WINAPI LoadFile (HWND, char *);
242:
243: // globals and function prototypes defined in PTFIND.C
244: extern char lpszSearch[MAXSEARCHSTRING+1];
245: extern HWND hDlgSearch;
246: BOOL WINAPI FindDialog (HWND, WORD, WORD, char *);
247: BOOL WINAPI LocateText (HWND, WORD, WORD, char *);
248:
249: // globals and function prototypes defined in PTPRINT.C
250: #define UM_CANCELPRINT WM_USER+2
251: int WINAPI PrintFile (HWND);
252: int WINAPI PrinterSetup (HWND);
253: BOOL WINAPI GetPrinterConfig (HWND);
254:
255: // globals and function prototypes defined in PTDLGS.C
256: BOOL WINAPI OptionsDlgProc (HWND, UINT, UINT, LONG);
257: BOOL WINAPI PortDlgProc (HWND, UINT, UINT, LONG);
258: BOOL WINAPI BkPortDlgProc (HWND, UINT, UINT, LONG);
259:
260: // globals and function prototypes defined in PTBKPORT.C
261: #define UM_THREADCOMPLETE WM_USER+2
262: #define UM_STATUSUPDATE WM_USER+3
263: HANDLE WINAPI StartBkPortThread (LPBKPORTFILESTRUCT);
264: BOOL WINAPI CreateEvents (HANDLE *, LPBKPORTFILESTRUCT);
265: void WINAPI DestroyEvents (HANDLE *);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.