|
|
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: /****************************** Module Header *******************************
13: * Module Name: dlgedit.h
14: *
15: * Main header file for the dialog box editor.
16: *
17: ****************************************************************************/
18:
19: #define NOMINMAX
20: #include <windows.h>
21: #include <custcntl.h>
22: #include <setjmp.h>
23: #include "ids.h"
24:
25:
26: /*
27: * For unicode support.
28: */
29: LPWSTR itoaw(INT value, LPWSTR string, INT radix);
30: INT awtoi(LPWSTR string);
31:
32: /*
33: * temporary define
34: */
35: #define BS_PUSHBOX 0x0AL
36:
37:
38: #define STATICFN static
39:
40: #define WINDOWPROC LONG APIENTRY
41: #define DIALOGPROC BOOL APIENTRY
42:
43: typedef HWND FAR *LPHWND;
44:
45: /*
46: * Used to create a window of "DIALOG" class.
47: */
48: #define DIALOGCLASS 0x8002
49:
50: #define ORDID_RT_RESOURCE32 0x00 // Aligned res file dummy resource.
51: #define ORDID_RT_DIALOG 0x05 // Dialog resource type.
52: #define ORDID_RT_DLGINCLUDE 0x11 // Dialog include file resource type.
53:
54:
55: /*
56: * The ordinal for the name of the DLGINCLUDE resource.
57: */
58: #define ORDID_DLGINCLUDE_NAME 1
59:
60:
61: /*
62: * Macro to pack a point into a long value.
63: */
64: #define POINT2LONG(pt, l) (l = MAKELONG(LOWORD((pt).x), LOWORD((pt).y)))
65:
66:
67: /*
68: * Macros to simplify working with menus.
69: */
70: #define MyEnableMenuItem(hMenu, wIDEnableItem, fEnable) \
71: EnableMenuItem((hMenu),(wIDEnableItem),(fEnable)?MF_ENABLED:MF_GRAYED)
72:
73: #define MyEnableMenuItemByPos(hMenu, wPosEnableItem, fEnable) \
74: EnableMenuItem((hMenu),(wPosEnableItem),(fEnable)? \
75: MF_ENABLED | MF_BYPOSITION:MF_GRAYED | MF_BYPOSITION)
76:
77: #define MyCheckMenuItem(hMenu, wIDCheckItem, fCheck) \
78: CheckMenuItem((hMenu),(wIDCheckItem),(fCheck)?MF_CHECKED:MF_UNCHECKED)
79:
80: /*
81: * This macro returns TRUE if the given string is an ordinal.
82: */
83: #define IsOrd(psz) (((PORDINAL)(psz))->wReserved == \
84: (WORD)0xffff ? TRUE : FALSE)
85:
86: /*
87: * This macro returns the ordinal id in the specified name/ord field.
88: */
89: #define OrdID(psz) (((PORDINAL)(psz))->wOrdID)
90:
91:
92: /*
93: * Integer property values.
94: */
95: #define PROP_FNCHILD MAKEINTRESOURCE(0x3345)
96:
97: /*
98: * Macro to set/remove an NPCTYPE pointer into a control or dialog hwnd.
99: */
100: #define SETPCINTOHWND(hwnd, npc) \
101: SetWindowLong((hwnd), GWL_USERDATA, (DWORD)(npc))
102:
103: #define UNSETPCINTOHWND(hwnd) (hwnd)
104:
105: /*
106: * Macro to extract an NPCTYPE from a control or dialog hwnd.
107: */
108: #define PCFROMHWND(hwnd) ((NPCTYPE)GetWindowLong(hwnd, GWL_USERDATA))
109:
110: /*
111: * Macros to set and retrieve the original window proc from
112: * a child window that has been subclassed by the editor.
113: */
114: #define SETCHILDPROC(hwnd, lpfn) SetProp((hwnd), PROP_FNCHILD, (HANDLE)(lpfn))
115: #define GETCHILDPROC(hwnd) ((WNDPROC)GetProp((hwnd), PROP_FNCHILD))
116: #define UNSETCHILDPROC(hwnd) RemoveProp((hwnd), PROP_FNCHILD)
117:
118:
119: /*
120: * Used to indicate an "impossible" file position (offset).
121: */
122: #define FPOS_MAX ((DWORD)(-1L))
123:
124:
125: /*
126: * Special flag I place in the resource that goes into the clipboard
127: * that means that only the controls in the dialog template in the
128: * clipboard are to be copied, not the entire dialog. Because this
129: * value is placed into the cx field of the dialog template, it can
130: * only be a WORD in size. I use 0xffff (-1) because this would be
131: * an impossible value for the width of a dialog.
132: */
133: #define CONTROLS_ONLY ((WORD)0xffff)
134:
135:
136: /*
137: * Some colors used in the editor.
138: */
139: #define LIGHTGRAY RGB(192, 192, 192)
140: #define DARKGRAY RGB(128, 128, 128)
141: #define REPLACECOLOR1 RGB(255, 255, 255) // White
142: #define REPLACECOLOR2 RGB(0, 0, 0) // Black
143:
144: /*
145: * Maximum size of a file name plus path specification.
146: */
147: #define CCHMAXPATH 260
148:
149: /*
150: * Maximum length of a long hex value ("0x" + 8 digits) not counting the null.
151: */
152: #define CCHHEXLONGMAX 10
153:
154: /*
155: * Maximum number of characters in an ID not counting the null character.
156: * This allows room for "0xFFFF" or "-32768".
157: */
158: #define CCHIDMAX 6
159:
160: /*
161: * Width and height of a handle in pixels.
162: */
163: #define CHANDLESIZE 6
164:
165: /*
166: * Height in DU's of the edit field of a combobox.
167: */
168: #define COMBOEDITHEIGHT 12
169:
170:
171: /*
172: * Character constants.
173: */
174: #define CHAR_NULL L'\0'
175: #define CHAR_TAB L'\t'
176: #define CHAR_NEWLINE L'\n'
177: #define CHAR_RETURN L'\r'
178: #define CHAR_BACKSLASH L'\\'
179: #define CHAR_COLON L':'
180: #define CHAR_DOT L'.'
181: #define CHAR_UNDERLINE L'_'
182: #define CHAR_ASTERISK L'*'
183: #define CHAR_SLASH L'/'
184: #define CHAR_POUND L'#'
185: #define CHAR_ORSYMBOL L'|'
186: #define CHAR_COMMA L','
187: #define CHAR_SPACE L' '
188: #define CHAR_DBLQUOTE L'"'
189: #define CHAR_MINUS L'-'
190: #define CHAR_PLUS L'+'
191: #define CHAR_0 L'0'
192: #define CHAR_A L'a'
193: #define CHAR_CAP_A L'A'
194: #define CHAR_F L'f'
195: #define CHAR_CAP_F L'F'
196: #define CHAR_X L'x'
197: #define CHAR_CAP_X L'X'
198: #define CHAR_Z L'z'
199: #define CHAR_CAP_Z L'Z'
200: #define CHAR_DOSEOF L'\x1a'
201:
202:
203: /*
204: * Defines for the different drag handles.
205: */
206: #define DRAG_CENTER (-1)
207: #define DRAG_LEFTBOTTOM 0
208: #define DRAG_BOTTOM 1
209: #define DRAG_RIGHTBOTTOM 2
210: #define DRAG_RIGHT 3
211: #define DRAG_RIGHTTOP 4
212: #define DRAG_TOP 5
213: #define DRAG_LEFTTOP 6
214: #define DRAG_LEFT 7
215:
216: /*
217: * Count of lines to insert into listbox and combobox controls during
218: * test mode.
219: */
220: #define CLBTESTLINES 25
221:
222: #define CCHTEXTMAX 256
223: #define CCHFILEBUFFER 256
224:
225: /*
226: * Timer ID for the pre-drag timer.
227: */
228: #define TID_PREDRAG 5
229:
230: /*
231: * The id of the "unused" item. This is the id value for controls
232: * that the user creates where they do not care about the value
233: * of the id because it will not be referenced in their code.
234: */
235: #define IDUNUSED (-1)
236:
237: /*
238: * Defines for the NextID() function.
239: */
240: #define NEXTID_DIALOG 0 /* ID for a new dialog. */
241: #define NEXTID_CONTROL 1 /* ID for a new control. */
242: #define NEXTID_LABEL 2 /* ID for a new label. */
243:
244: /*
245: * Flags for the GridizeRect function. They specify which points in
246: * the rectangle to apply gridding to.
247: */
248: #define GRIDIZE_LEFT 0x0001 // Gridize the left edge.
249: #define GRIDIZE_BOTTOM 0x0002 // Gridize the bottom edge.
250: #define GRIDIZE_RIGHT 0x0004 // Gridize the right edge.
251: #define GRIDIZE_TOP 0x0008 // Gridize the top edge.
252: #define GRIDIZE_SAMESIZE 0x0010 // Don't change cx or cy.
253:
254: /*
255: * Default spacing constants.
256: */
257: #define DEFCXGRID 1 // X grid.
258: #define DEFCYGRID 1 // Y grid.
259: #define DEFXMARGIN 6 // Top/bottom margin.
260: #define DEFYMARGIN 6 // Left/right margin.
261: #define DEFXMINPUSHSPACE 3 // Min. horizontal button spacing.
262: #define DEFXMAXPUSHSPACE 16 // Max. horizontal button spacing.
263: #define DEFYPUSHSPACE 3 // Vertical button spacing.
264: #define DEFXSPACE 6 // Horizontal control spacing.
265: #define DEFYSPACE 0 // Vertical control spacing.
266:
267: #define IC_UNKNOWN (-1)
268: #define IC_BUTTON 0
269: #define IC_SCROLLBAR 1
270: #define IC_EDIT 2
271: #define IC_STATIC 3
272: #define IC_LISTBOX 4
273: #define IC_COMBOBOX 5
274: #define IC_CUSTOM 6
275: #define IC_DIALOG 7
276: #define IC_WINDOW 8
277: #define IC_RESFLAGS 9
278: #define IC_EXSTYLE 10
279:
280: #define MSG_DELETEDIALOG 0
281: #define MSG_OUTOFMEMORY 1
282: #define MSG_CANTCREATE 2
283: #define MSG_SYMNOCHANGE 3
284: #define MSG_IDSYMMISMATCH 4
285: #define MSG_CLOSING 5
286: #define MSG_BADRESFILE 6
287: #define MSG_INCLCLOSING 7
288: #define MSG_SYMEXISTS 8
289: #define MSG_BADSYMBOLID 9
290: #define MSG_LABELDUPID 10
291: #define MSG_SELECTFIRST 11
292: #define MSG_CTRLDUPID 12
293: #define MSG_BADCUSTDLL 13
294: #define MSG_NOCLIP 14
295: #define MSG_INTERNAL 15
296: #define MSG_NOMOUSE 16
297: #define MSG_NOINIT 17
298: #define MSG_GTZERO 18
299: #define MSG_ICONNAMEHASBLANKS 19
300: #define MSG_IDUPIDS 20
301: #define MSG_CREATECTRLERROR 21
302: #define MSG_CANTOPENRES 22
303: #define MSG_CONFIRMDISCARD 23
304: #define MSG_SYMNOTFOUND 24
305: #define MSG_NOCLASS 25
306: #define MSG_POSITIVENUM 26
307: #define MSG_MEMERROR 27
308: #define MSG_DLGNAMEHASBLANKS 28
309: #define MSG_NODLGNAME 29
310: #define MSG_CANTINITDLL 30
311: #define MSG_NOICONNAME 31
312: #define MSG_RESTOREDIALOG 32
313: #define MSG_ZEROPOINTSIZE 33
314: #define MSG_MINGTMAXSPACE 34
315: #define MSG_CUSTCNTLINUSE 35
316: #define MSG_CUSTALREADYLOADED 36
317: #define MSG_CANTLOADDLL 37
318: #define MSG_DLLBADEXPORTS 38
319: #define MSG_DLLBADCOUNT 39
320:
321: /*
322: * The following defines are used as masks in the styles arrays.
323: * They each define a set of bits, all of which have to be set
324: * properly for any of the individual styles to be considered
325: * to be a match. They are used for groups of styles that do
326: * not have a single bit set. In other words, these styles
327: * depend on having some bits OFF, as well as other bits ON.
328: */
329: #define BS_ALL (BS_PUSHBUTTON | BS_DEFPUSHBUTTON | BS_CHECKBOX | \
330: BS_AUTOCHECKBOX | BS_RADIOBUTTON | BS_3STATE | \
331: BS_AUTO3STATE | BS_GROUPBOX | BS_USERBUTTON | \
332: BS_AUTORADIOBUTTON | BS_PUSHBOX | BS_OWNERDRAW)
333: #define SS_ALL (SS_LEFT | SS_CENTER | SS_RIGHT | SS_ICON | \
334: SS_BLACKRECT | SS_GRAYRECT | SS_WHITERECT | \
335: SS_BLACKFRAME | SS_GRAYFRAME | SS_WHITEFRAME | \
336: SS_USERITEM | SS_SIMPLE | SS_LEFTNOWORDWRAP)
337: #define CBS_ALL (CBS_SIMPLE | CBS_DROPDOWN | CBS_DROPDOWNLIST)
338: #define SBS_ALL (SBS_HORZ | SBS_VERT)
339: #define ES_ALIGN (ES_LEFT | ES_CENTER | ES_RIGHT)
340: #define WS_CAPTIONALL (WS_CAPTION | WS_BORDER | WS_DLGFRAME)
341:
342: /*
343: * Possible values for gState, which tells us about special modes
344: * (states) the editor is in.
345: */
346: #define STATE_NORMAL 0 // Normal state.
347: #define STATE_DRAGGINGNEW 1 // Dragging a new control from the toolbox.
348: #define STATE_DRAGGING 2 // Dragging an existing control.
349: #define STATE_SELECTING 3 // Outline selecting is in progress.
350: #define STATE_PREDRAG 4 // During debounce period before dragging.
351:
352: /*
353: * Control type (W_*) constants. These are used as indexes into the
354: * awcd structure that describes each type of class.
355: */
356: #define W_NOTHING (-1)
357:
358: #define W_TEXT 0
359: #define W_EDIT 1
360: #define W_GROUPBOX 2
361: #define W_PUSHBUTTON 3
362: #define W_CHECKBOX 4
363: #define W_RADIOBUTTON 5
364: #define W_COMBOBOX 6
365: #define W_LISTBOX 7
366: #define W_HORZSCROLL 8
367: #define W_VERTSCROLL 9
368: #define W_FRAME 10
369: #define W_RECT 11
370: #define W_ICON 12
371: #define W_CUSTOM 13
372:
373: #define W_DIALOG 14
374:
375: /*
376: * Number of control types. Note that this does NOT count the
377: * "W_DIALOG" type, only actual controls like "W_CHECKBOX", etc.
378: */
379: #define CCONTROLS 14
380:
381: /*
382: * The following defines have the location (by zero based position)
383: * of popup menu items. If the menu arrangement is changed in the
384: * .RC file, these defines MUST be updated!
385: */
386: #define MENUPOS_FILE 0
387: #define MENUPOS_EDIT 1
388: #define MENUPOS_ARRANGE 2
389: #define MENUPOS_ARRANGEALIGN 0
390: #define MENUPOS_ARRANGESPACE 1
391: #define MENUPOS_ARRANGESIZE 2
392: #define MENUPOS_ARRANGEPUSH 3
393:
394:
395: /*
396: * Resource memory management flags.
397: */
398: #define MMF_MOVEABLE 0x0010
399: #define MMF_PURE 0x0020
400: #define MMF_PRELOAD 0x0040
401: #define MMF_DISCARDABLE 0x1000
402:
403: #define DEFDLGMEMFLAGS (MMF_MOVEABLE | MMF_PURE | MMF_DISCARDABLE)
404:
405: /*
406: * Default location of a new dialog.
407: */
408: #define DEFDIALOGXPOS 6
409: #define DEFDIALOGYPOS 18
410:
411: /*
412: * Default point size for a new dialog's font. The default face name
413: * is in the string IDS_DEFFONTNAME.
414: */
415: #define DEFPOINTSIZE 8
416:
417:
418: #define FILE_NOSHOW 0x0001 /* Save without prompting for name */
419: #define FILE_INCLUDE 0x0002 /* Save/load include file */
420: #define FILE_RESOURCE 0x0004 /* Save/load resource file */
421: #define FILE_SAVEAS 0x0008 /* Save as (prompt for file name). */
422: #define FILE_DLL 0x0010 /* A custom control DLL file. */
423:
424:
425: /*
426: * Special case ordinal id values for the predefined control classes.
427: */
428: #define ORDID_BUTTONCLASS 0x80
429: #define ORDID_EDITCLASS 0x81
430: #define ORDID_STATICCLASS 0x82
431: #define ORDID_LISTBOXCLASS 0x83
432: #define ORDID_SCROLLBARCLASS 0x84
433: #define ORDID_COMBOBOXCLASS 0x85
434:
435: /*
436: * This structure is used to link resources.
437: */
438: typedef struct tagRESLINK {
439: struct tagRESLINK *prlNext; /* Next in list. */
440: BOOL fDlgResource; /* TRUE if this is a dialog resource. */
441: INT cbRes; /* Size of the resource. */
442: HANDLE hRes; /* Handle to global memory with the res.*/
443: LPTSTR pszName; /* Name/ord of the resource (if dialog).*/
444: WORD wLanguage; /* Language identifier (if dialog). */
445: } RESLINK, *PRESLINK;
446:
447: /*
448: * Describes a window class.
449: *
450: * The flStyles field is the default styles that this control type will have
451: * when first created. The flStylesBad field is the styles that can cause
452: * problems when manipulating the control in work mode, such as *_OWNERDRAW
453: * and so forth. Controls with this style can be created with the editor
454: * and will be saved as such in the .DLG file, but the actual control created
455: * in work mode will not have any of these styles.
456: */
457: typedef struct {
458: INT iType; /* Control type index, one of the W_ constants. */
459: DWORD flStyles; /* Default control styles for this window class.*/
460: DWORD flStylesBad; /* Styles NOT to use when creating this control.*/
461: DWORD flStylesTestBad; /* Styles NOT to use in Test mode. */
462: DWORD flExtStyle; /* Default extended styles. */
463: INT cxDefault; /* Default x size for this control. */
464: INT cyDefault; /* Default y size for this control. */
465: INT iClass; /* Index to the IC_ class for this window class.*/
466: LPTSTR pszClass; /* Class name (for custom controls). */
467: UINT fEmulated:1; /* TRUE if this is an emulated custom control. */
468: UINT fUnicodeDLL:1; /* TRUE if the DLL functions are UNICODE. */
469: UINT fHasText:1; /* TRUE if this control type can have text. */
470: UINT fSizeable:1; /* TRUE if the control can be sized. */
471: UINT fSizeToText:1; /* TRUE if the control can be sized to its text.*/
472: INT idStylesDialog; /* Styles dialog id for this window class. */
473: WNDPROC pfnStylesDlgProc; /* Styles dialog procedure. */
474: INT HelpContext; /* Help context ID for the styles dialog. */
475: UINT idsTextDefault; /* String id of default text. */
476: LPTSTR pszTextDefault; /* Default text for a new control of this type. */
477: WNDPROC pfnOldWndProc; /* Saves the old window proc when subclassing. */
478: INT idbmCtrlType; /* ID of the bitmap res. for this control type. */
479: HBITMAP hbmCtrlType; /* Handle of the bitmap for this control type. */
480: HBITMAP hbmCtrlTypeSel; /* The selected version of the above. */
481: INT idbmToolBtnUp; /* ID of "up" bmp res. for the Toolbox button. */
482: HBITMAP hbmToolBtnUp; /* hbm of "up" bitmap for the Toolbox button. */
483: INT idbmToolBtnDown; /* ID of "down" bmp res. for the Toolbox button.*/
484: HBITMAP hbmToolBtnDown; /* hbm of "down" bitmap for the Toolbox button. */
485: HANDLE hmod; /* Custom control DLL module handle. */
486: INT cStyleFlags; /* Count of custom control style flags. */
487: LPCCSTYLEFLAG aStyleFlags; /* Ptr to custom control style flag table. */
488: PROC lpfnStyle; /* Custom control Style function. */
489: PROC lpfnSizeToText; /* Custom control SizeToText function. */
490: DWORD flCtrlTypeMask; /* Mask for custom control type styles. */
491: } WINDOWCLASSDESC;
492: typedef WINDOWCLASSDESC *PWINDOWCLASSDESC;
493:
494: typedef struct tagCTYPE {
495: struct tagCTYPE *npcNext; /* Next CTYPE in linked list. */
496: PWINDOWCLASSDESC pwcd; /* Points to the window class desc. struct. */
497: HWND hwnd; /* Handle of control window. */
498: HWND hwndDrag; /* Handle of the drag window for this ctrl. */
499: DWORD flStyle; /* Control style. */
500: DWORD flExtStyle; /* Control extended style. */
501: INT id; /* Control window id. */
502: LPTSTR text; /* Text for control window. */
503: RECT rc; /* Location and size of the control. */
504: UINT fSelected:1; /* TRUE if the control is selected. */
505: UINT fGroupEnd:1; /* TRUE if ctrl is the last one in a group. */
506: } CTYPE;
507: typedef CTYPE *NPCTYPE;
508:
509: typedef struct tagLABEL {
510: struct tagLABEL *npNext; /* pointer to next in the list */
511: LPTSTR pszLabel; /* Name of the symbol */
512: INT id; /* ID value for this label */
513: INT idOrig; /* Original ID value for this label */
514: DWORD fpos; /* File pointer to "#define" in include file*/
515: INT nValueOffset; /* Offset to id value start from fpos */
516: } LABEL;
517: typedef LABEL *NPLABEL;
518:
519: /*
520: * Structure that is used to link together a list of custom controls.
521: * Each link points to an associated WINDOWCLASSDESC structure that
522: * defines the custom control type in detail.
523: */
524: typedef struct tagCUSTLINK {
525: struct tagCUSTLINK *pclNext;/* Next CUSTLINK in linked list. */
526: LPTSTR pszFileName; /* Full path to DLL file (NULL if emulated).*/
527: LPTSTR pszDesc; /* Short, descriptive text for the control. */
528: PWINDOWCLASSDESC pwcd; /* Points to the window class desc. struct. */
529: } CUSTLINK, *PCUSTLINK;
530:
531: typedef struct {
532: UINT ids; /* String id for the message text. */
533: UINT fMessageBox; /* Flags for the MessageBox function. */
534: } MESSAGEDATA;
535:
536: /*
537: * Class Style structure. Specifies the style bits that describe
538: * each style, along with a mask that specifies the bits to compare
539: * when looking for this style. The mask is necessary when more than
540: * one bit specifies a style. For example, look at the BS_* styles,
541: * which currently use the low 3 bits of the style flag to specify
542: * eight different styles. The idControl field is the checkbox or
543: * radio button control id in the styles dialogs that corresponds to
544: * this particular style, or zero if it is not settable by the user.
545: */
546: typedef struct {
547: DWORD flStyle; /* Style bits that identify this style. */
548: DWORD flStyleMask; /* Mask with the relevant bits. */
549: INT idControl; /* ID of the control in the styles dlg. */
550: } CLASSSTYLE, *PCLASSSTYLE;
551:
552: /*
553: * RC Keyword structure. This describes a predefined RC keyword, like
554: * "RADIOBUTTON" and "LISTBOX".
555: *
556: * rckwd, prckwd
557: */
558: typedef struct {
559: DWORD flStyle; /* Style that identifies this keyword. */
560: DWORD flStyleMask; /* Mask with the relevant bits. */
561: DWORD flStyleDefault; /* Other style bits implicitly defined. */
562: UINT idsKeyword; /* The RC keyword. */
563: BOOL fHasText; /* TRUE if this keywd has a text field. */
564: } RCKEYWORD, *PRCKEYWORD;
565:
566: /*
567: * Class style description structure. These contain information on each
568: * of the IC_* constants.
569: *
570: * csd, pcsd
571: */
572: typedef struct {
573: UINT idsClass; /* Class string for this class. */
574: PCLASSSTYLE pacs; /* Pointer to class styles array. */
575: INT cClassStyles; /* Count of class styles. */
576: UINT idsStylesStart; /* Starting index to style strings. */
577: PRCKEYWORD parckwd; /* Pointer to predefined RC keywords. */
578: INT cKeywords; /* Count of predefined RC keywords. */
579: WORD idOrd; /* Predefined ordinal id for this class. */
580: } CLASSSTYLEDESC;
581:
582: /*
583: * One single entry for an environment setting saved in the
584: * profile file. Used by ReadEnv and WriteEnv.
585: */
586: typedef struct _INIENTRY {
587: LPTSTR pszKeyName;
588: PINT pnVar;
589: INT nDefault;
590: INT nSave;
591: } INIENTRY;
592:
593: /*
594: * This structure defines additional information on the dialog being
595: * edited that only pertains to dialogs, not controls. This information
596: * is therefore in a separate structure rather than the CTYPE structure.
597: * Any dialog specific information that can be changed using the Dialog
598: * Styles dialog must be contained in this structure.
599: */
600: typedef struct {
601: WORD fResFlags; /* Dialog resource memory flags. */
602: WORD wLanguage; /* Language identifier for the dialog. */
603: LPTSTR pszClass; /* The dialog's class (or NULL). */
604: LPTSTR pszMenu; /* The dialog's menu (or NULL). */
605: DWORD DataVersion; /* Data Version data for this dialog. */
606: DWORD Version; /* Version data for this dialog. */
607: DWORD Characteristics; /* Characteristics data for this dialog.*/
608: INT nPointSize; /* Point size of the dialog's font. */
609: TCHAR szFontName[LF_FACESIZE]; /* Face name of the dialog's font. */
610: } DIALOGINFO, *PDIALOGINFO;
611:
612: /*
613: * This structure contains the globals that describe the current
614: * dialog being edited.
615: */
616: typedef struct {
617: NPCTYPE npc; /* CTYPE structure for the dialog. */
618: LPTSTR pszDlgName; /* Current dialog's name. */
619: PRESLINK prl; /* NULL or the dlg's resource link. */
620: BOOL fFontSpecified; /* TRUE if a font is set for the dialog.*/
621: HFONT hFont; /* Font handle of the dialog's font. */
622: INT cxChar; /* Pixel width of character box. */
623: INT cyChar; /* Pixel height of character box. */
624: DIALOGINFO di; /* Additional info for current dialog. */
625: } CURRENTDLG;
626:
627: /*
628: * Structure that maps a subject (like a menu id or a dialog id) with
629: * a help context to pass in to WinHelp.
630: */
631: typedef struct {
632: INT idSubject; /* Subject, usually a menu or dialog id.*/
633: INT HelpContext; /* The matching help context. */
634: } HELPMAP;
635: typedef HELPMAP *PHELPMAP;
636:
637:
638: /*
639: * The aligned ordinal structure. Ordinals start with a word that is
640: * always 0xffff, followed by a word that contains the ordinal id.
641: */
642: typedef struct {
643: WORD wReserved;
644: WORD wOrdID;
645: } ORDINAL, *PORDINAL;
646:
647:
648: typedef struct {
649: DWORD DataSize; // Size of data.
650: DWORD HeaderSize; // Size of the resource header.
651: } RES, *PRES;
652:
653: typedef struct {
654: DWORD DataVersion; // Predefined resource data version.
655: WORD MemoryFlags; // Resource memory flags.
656: WORD LanguageId; // UNICODE support for NLS.
657: DWORD Version; // Version of the resource data.
658: DWORD Characteristics; // Characteristics of the data.
659: } RES2, *PRES2;
660:
661:
662: typedef struct {
663: DWORD lStyle; // Style for the dialog.
664: DWORD lExtendedStyle; // The extended style.
665: WORD NumberOfItems; // Number of controls.
666: WORD x; // Starting x location.
667: WORD y; // Starting y location.
668: WORD cx; // Dialog width.
669: WORD cy; // Dialog height.
670: } *PDIALOGBOXHEADER;
671:
672: #define SIZEOF_DIALOGBOXHEADER ( \
673: sizeof(DWORD) + /* lStyle */ \
674: sizeof(DWORD) + /* lExtendedStyle */ \
675: sizeof(WORD) + /* NumberOfItems */ \
676: sizeof(WORD) + /* x */ \
677: sizeof(WORD) + /* y */ \
678: sizeof(WORD) + /* cx */ \
679: sizeof(WORD) /* cy */ \
680: )
681:
682:
683: typedef struct {
684: DWORD lStyle; // Style for the control.
685: DWORD lExtendedStyle; // The extended style.
686: WORD x; // Starting x location.
687: WORD y; // Starting y location.
688: WORD cx; // Control width.
689: WORD cy; // Control height.
690: WORD wId; // Control id.
691: } *PCONTROLDATA;
692:
693: #define SIZEOF_CONTROLDATA ( \
694: sizeof(DWORD) + /* lStyle */ \
695: sizeof(DWORD) + /* lExtendedStyle */ \
696: sizeof(WORD) + /* x */ \
697: sizeof(WORD) + /* y */ \
698: sizeof(WORD) + /* cx */ \
699: sizeof(WORD) + /* cy */ \
700: sizeof(WORD)) /* wId */
701:
702:
703: /*
704: * SubLanguage table structure. This structure describes each entry of a
705: * sub language table. These tables are pointed to by each entry in
706: * the language table.
707: */
708: typedef struct {
709: WORD wSubLang; // SubLanguage value.
710: INT idsSubLang; // String id of SUBLANG_* define.
711: INT idsSubLangDesc; // String id of sub-lang description.
712: } SUBLANGTABLE, *PSUBLANGTABLE;
713:
714: /*
715: * Language table structure. This structure describes each entry in the
716: * language table, which describes each unicode language.
717: */
718: typedef struct {
719: WORD wPrimary; // Language primary value.
720: INT idsLang; // String id of LANG_* define.
721: INT idsLangDesc; // String id of language description.
722: INT cSubLangs; // Number of sublanguages for this lang.
723: PSUBLANGTABLE asl; // Points to table of sublanguages.
724: } LANGTABLE;
725:
726:
727:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.