home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / sdktools / winnt / dlgedit / dlgedit.h < prev    next >
C/C++ Source or Header  |  1997-10-05  |  29KB  |  732 lines

  1.  
  2. /******************************************************************************\
  3. *       This is a part of the Microsoft Source Code Samples. 
  4. *       Copyright (C) 1993-1997 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. #ifdef JAPAN
  416. #define DEFPOINTSIZE    12
  417. #else
  418. #define DEFPOINTSIZE    8
  419. #endif
  420.  
  421.  
  422. #define FILE_NOSHOW             0x0001  /* Save without prompting for name  */
  423. #define FILE_INCLUDE            0x0002  /* Save/load include file           */
  424. #define FILE_RESOURCE           0x0004  /* Save/load resource file          */
  425. #define FILE_SAVEAS             0x0008  /* Save as (prompt for file name).  */
  426. #define FILE_DLL                0x0010  /* A custom control DLL file.       */
  427.  
  428.  
  429. /*
  430.  * Special case ordinal id values for the predefined control classes.
  431.  */
  432. #define ORDID_BUTTONCLASS           0x80
  433. #define ORDID_EDITCLASS             0x81
  434. #define ORDID_STATICCLASS           0x82
  435. #define ORDID_LISTBOXCLASS          0x83
  436. #define ORDID_SCROLLBARCLASS        0x84
  437. #define ORDID_COMBOBOXCLASS         0x85
  438.  
  439. /*
  440.  * This structure is used to link resources.
  441.  */
  442. typedef struct tagRESLINK {
  443.     struct tagRESLINK *prlNext;     /* Next in list.                        */
  444.     BOOL fDlgResource;              /* TRUE if this is a dialog resource.   */
  445.     INT cbRes;                      /* Size of the resource.                */
  446.     HANDLE hRes;                    /* Handle to global memory with the res.*/
  447.     LPTSTR pszName;                 /* Name/ord of the resource (if dialog).*/
  448.     WORD wLanguage;                 /* Language identifier (if dialog).     */
  449. } RESLINK, *PRESLINK;
  450.  
  451. /*
  452.  * Describes a window class.
  453.  *
  454.  * The flStyles field is the default styles that this control type will have
  455.  * when first created.  The flStylesBad field is the styles that can cause
  456.  * problems when manipulating the control in work mode, such as *_OWNERDRAW
  457.  * and so forth.  Controls with this style can be created with the editor
  458.  * and will be saved as such in the .DLG file, but the actual control created
  459.  * in work mode will not have any of these styles.
  460.  */
  461. typedef struct {
  462.     INT iType;              /* Control type index, one of the W_ constants. */
  463.     DWORD flStyles;         /* Default control styles for this window class.*/
  464.     DWORD flStylesBad;      /* Styles NOT to use when creating this control.*/
  465.     DWORD flStylesTestBad;  /* Styles NOT to use in Test mode.              */
  466.     DWORD flExtStyle;       /* Default extended styles.                     */
  467.     INT cxDefault;          /* Default x size for this control.             */
  468.     INT cyDefault;          /* Default y size for this control.             */
  469.     INT iClass;             /* Index to the IC_ class for this window class.*/
  470.     LPTSTR pszClass;        /* Class name (for custom controls).            */
  471.     UINT fEmulated:1;       /* TRUE if this is an emulated custom control.  */
  472.     UINT fUnicodeDLL:1;     /* TRUE if the DLL functions are UNICODE.       */
  473.     UINT fHasText:1;        /* TRUE if this control type can have text.     */
  474.     UINT fSizeable:1;       /* TRUE if the control can be sized.            */
  475.     UINT fSizeToText:1;     /* TRUE if the control can be sized to its text.*/
  476.     INT idStylesDialog;     /* Styles dialog id for this window class.      */
  477.     WNDPROC pfnStylesDlgProc; /* Styles dialog procedure.                   */
  478.     INT HelpContext;        /* Help context ID for the styles dialog.       */
  479.     UINT idsTextDefault;    /* String id of default text.                   */
  480.     LPTSTR pszTextDefault;  /* Default text for a new control of this type. */
  481.     WNDPROC pfnOldWndProc;  /* Saves the old window proc when subclassing.  */
  482.     INT idbmCtrlType;       /* ID of the bitmap res. for this control type. */
  483.     HBITMAP hbmCtrlType;    /* Handle of the bitmap for this control type.  */
  484.     HBITMAP hbmCtrlTypeSel; /* The selected version of the above.           */
  485.     INT idbmToolBtnUp;      /* ID of "up" bmp res. for the Toolbox button.  */
  486.     HBITMAP hbmToolBtnUp;   /* hbm of "up" bitmap for the Toolbox button.   */
  487.     INT idbmToolBtnDown;    /* ID of "down" bmp res. for the Toolbox button.*/
  488.     HBITMAP hbmToolBtnDown; /* hbm of "down" bitmap for the Toolbox button. */
  489.     HANDLE hmod;            /* Custom control DLL module handle.            */
  490.     INT cStyleFlags;        /* Count of custom control style flags.         */
  491.     LPCCSTYLEFLAG aStyleFlags; /* Ptr to custom control style flag table.   */
  492.     PROC lpfnStyle;         /* Custom control Style function.               */
  493.     PROC lpfnSizeToText;    /* Custom control SizeToText function.          */
  494.     DWORD flCtrlTypeMask;   /* Mask for custom control type styles.         */
  495. } WINDOWCLASSDESC;
  496. typedef WINDOWCLASSDESC *PWINDOWCLASSDESC;
  497.  
  498. typedef struct tagCTYPE {
  499.     struct tagCTYPE *npcNext;   /* Next CTYPE in linked list.               */
  500.     PWINDOWCLASSDESC pwcd;      /* Points to the window class desc. struct. */
  501.     HWND hwnd;                  /* Handle of control window.                */
  502.     HWND hwndDrag;              /* Handle of the drag window for this ctrl. */
  503.     DWORD flStyle;              /* Control style.                           */
  504.     DWORD flExtStyle;           /* Control extended style.                  */
  505.     INT id;                     /* Control window id.                       */
  506.     LPTSTR text;                /* Text for control window.                 */
  507.     RECT rc;                    /* Location and size of the control.        */
  508.     UINT fSelected:1;           /* TRUE if the control is selected.         */
  509.     UINT fGroupEnd:1;           /* TRUE if ctrl is the last one in a group. */
  510. } CTYPE;
  511. typedef CTYPE *NPCTYPE;
  512.  
  513. typedef struct tagLABEL {
  514.     struct tagLABEL *npNext;    /* pointer to next in the list              */
  515.     LPTSTR pszLabel;            /* Name of the symbol                       */
  516.     INT id;                     /* ID value for this label                  */
  517.     INT idOrig;                 /* Original ID value for this label         */
  518.     DWORD fpos;                 /* File pointer to "#define" in include file*/
  519.     INT nValueOffset;           /* Offset to id value start from fpos       */
  520. } LABEL;
  521. typedef LABEL *NPLABEL;
  522.  
  523. /*
  524.  * Structure that is used to link together a list of custom controls.
  525.  * Each link points to an associated WINDOWCLASSDESC structure that
  526.  * defines the custom control type in detail.
  527.  */
  528. typedef struct tagCUSTLINK {
  529.     struct tagCUSTLINK *pclNext;/* Next CUSTLINK in linked list.            */
  530.     LPTSTR pszFileName;         /* Full path to DLL file (NULL if emulated).*/
  531.     LPTSTR pszDesc;             /* Short, descriptive text for the control. */
  532.     PWINDOWCLASSDESC pwcd;      /* Points to the window class desc. struct. */
  533. } CUSTLINK, *PCUSTLINK;
  534.  
  535. typedef struct {
  536.     UINT ids;                   /* String id for the message text.          */
  537.     UINT fMessageBox;           /* Flags for the MessageBox function.       */
  538. } MESSAGEDATA;
  539.  
  540. /*
  541.  * Class Style structure.  Specifies the style bits that describe
  542.  * each style, along with a mask that specifies the bits to compare
  543.  * when looking for this style.  The mask is necessary when more than
  544.  * one bit specifies a style.  For example, look at the BS_* styles,
  545.  * which currently use the low 3 bits of the style flag to specify
  546.  * eight different styles.  The idControl field is the checkbox or
  547.  * radio button control id in the styles dialogs that corresponds to
  548.  * this particular style, or zero if it is not settable by the user.
  549.  */
  550. typedef struct {
  551.     DWORD flStyle;              /* Style bits that identify this style.     */
  552.     DWORD flStyleMask;          /* Mask with the relevant bits.             */
  553.     INT idControl;              /* ID of the control in the styles dlg.     */
  554. } CLASSSTYLE, *PCLASSSTYLE;
  555.  
  556. /*
  557.  * RC Keyword structure.  This describes a predefined RC keyword, like
  558.  * "RADIOBUTTON" and "LISTBOX".
  559.  *
  560.  * rckwd, prckwd
  561.  */
  562. typedef struct {
  563.     DWORD flStyle;              /* Style that identifies this keyword.      */
  564.     DWORD flStyleMask;          /* Mask with the relevant bits.             */
  565.     DWORD flStyleDefault;       /* Other style bits implicitly defined.     */
  566.     UINT idsKeyword;            /* The RC keyword.                          */
  567.     BOOL fHasText;              /* TRUE if this keywd has a text field.     */
  568. } RCKEYWORD, *PRCKEYWORD;
  569.  
  570. /*
  571.  * Class style description structure.  These contain information on each
  572.  * of the IC_* constants.
  573.  *
  574.  * csd, pcsd
  575.  */
  576. typedef struct {
  577.     UINT idsClass;              /* Class string for this class.             */
  578.     PCLASSSTYLE pacs;           /* Pointer to class styles array.           */
  579.     INT cClassStyles;           /* Count of class styles.                   */
  580.     UINT idsStylesStart;        /* Starting index to style strings.         */
  581.     PRCKEYWORD parckwd;         /* Pointer to predefined RC keywords.       */
  582.     INT cKeywords;              /* Count of predefined RC keywords.         */
  583.     WORD idOrd;                 /* Predefined ordinal id for this class.    */
  584. } CLASSSTYLEDESC;
  585.  
  586. /*
  587.  * One single entry for an environment setting saved in the
  588.  * profile file.  Used by ReadEnv and WriteEnv.
  589.  */
  590. typedef struct _INIENTRY {
  591.     LPTSTR pszKeyName;
  592.     PINT pnVar;
  593.     INT nDefault;
  594.     INT nSave;
  595. } INIENTRY;
  596.  
  597. /*
  598.  * This structure defines additional information on the dialog being
  599.  * edited that only pertains to dialogs, not controls.  This information
  600.  * is therefore in a separate structure rather than the CTYPE structure.
  601.  * Any dialog specific information that can be changed using the Dialog
  602.  * Styles dialog must be contained in this structure.
  603.  */
  604. typedef struct {
  605.     WORD fResFlags;                 /* Dialog resource memory flags.        */
  606.     WORD wLanguage;                 /* Language identifier for the dialog.  */
  607.     LPTSTR pszClass;                /* The dialog's class (or NULL).        */
  608.     LPTSTR pszMenu;                 /* The dialog's menu (or NULL).         */
  609.     DWORD DataVersion;              /* Data Version data for this dialog.   */
  610.     DWORD Version;                  /* Version data for this dialog.        */
  611.     DWORD Characteristics;          /* Characteristics data for this dialog.*/
  612.     INT nPointSize;                 /* Point size of the dialog's font.     */
  613.     TCHAR szFontName[LF_FACESIZE];  /* Face name of the dialog's font.      */
  614. } DIALOGINFO, *PDIALOGINFO;
  615.  
  616. /*
  617.  * This structure contains the globals that describe the current
  618.  * dialog being edited.
  619.  */
  620. typedef struct {
  621.     NPCTYPE npc;                    /* CTYPE structure for the dialog.      */
  622.     LPTSTR pszDlgName;              /* Current dialog's name.               */
  623.     PRESLINK prl;                   /* NULL or the dlg's resource link.     */
  624.     BOOL fFontSpecified;            /* TRUE if a font is set for the dialog.*/
  625.     HFONT hFont;                    /* Font handle of the dialog's font.    */
  626.     INT cxChar;                     /* Pixel width of character box.        */
  627.     INT cyChar;                     /* Pixel height of character box.       */
  628.     DIALOGINFO di;                  /* Additional info for current dialog.  */
  629. } CURRENTDLG;
  630.  
  631. /*
  632.  * Structure that maps a subject (like a menu id or a dialog id) with
  633.  * a help context to pass in to WinHelp.
  634.  */
  635. typedef struct {
  636.     INT idSubject;                  /* Subject, usually a menu or dialog id.*/
  637.     INT HelpContext;                /* The matching help context.           */
  638. } HELPMAP;
  639. typedef HELPMAP *PHELPMAP;
  640.  
  641.  
  642. /*
  643.  * The aligned ordinal structure.  Ordinals start with a word that is
  644.  * always 0xffff, followed by a word that contains the ordinal id.
  645.  */
  646. typedef struct {
  647.     WORD wReserved;
  648.     WORD wOrdID;
  649. } ORDINAL, *PORDINAL;
  650.  
  651.  
  652. typedef struct {
  653.     DWORD DataSize;                 // Size of data.
  654.     DWORD HeaderSize;               // Size of the resource header.
  655. } RES, *PRES;
  656.  
  657. typedef struct {
  658.     DWORD DataVersion;              // Predefined resource data version.
  659.     WORD MemoryFlags;               // Resource memory flags.
  660.     WORD LanguageId;                // UNICODE support for NLS.
  661.     DWORD Version;                  // Version of the resource data.
  662.     DWORD Characteristics;          // Characteristics of the data.
  663. } RES2, *PRES2;
  664.  
  665.  
  666. typedef struct {
  667.     DWORD lStyle;                   // Style for the dialog.
  668.     DWORD lExtendedStyle;           // The extended style.
  669.     WORD NumberOfItems;             // Number of controls.
  670.     WORD x;                         // Starting x location.
  671.     WORD y;                         // Starting y location.
  672.     WORD cx;                        // Dialog width.
  673.     WORD cy;                        // Dialog height.
  674. } *PDIALOGBOXHEADER;
  675.  
  676. #define SIZEOF_DIALOGBOXHEADER  (                               \
  677.     sizeof(DWORD) +                 /* lStyle           */      \
  678.     sizeof(DWORD) +                 /* lExtendedStyle   */      \
  679.     sizeof(WORD) +                  /* NumberOfItems    */      \
  680.     sizeof(WORD) +                  /* x                */      \
  681.     sizeof(WORD) +                  /* y                */      \
  682.     sizeof(WORD) +                  /* cx               */      \
  683.     sizeof(WORD)                    /* cy               */      \
  684.     )
  685.  
  686.  
  687. typedef struct {
  688.     DWORD lStyle;                   // Style for the control.
  689.     DWORD lExtendedStyle;           // The extended style.
  690.     WORD x;                         // Starting x location.
  691.     WORD y;                         // Starting y location.
  692.     WORD cx;                        // Control width.
  693.     WORD cy;                        // Control height.
  694.     WORD wId;                       // Control id.
  695. } *PCONTROLDATA;
  696.  
  697. #define SIZEOF_CONTROLDATA  (                                   \
  698.     sizeof(DWORD) +                 /* lStyle           */      \
  699.     sizeof(DWORD) +                 /* lExtendedStyle   */      \
  700.     sizeof(WORD) +                  /* x                */      \
  701.     sizeof(WORD) +                  /* y                */      \
  702.     sizeof(WORD) +                  /* cx               */      \
  703.     sizeof(WORD) +                  /* cy               */      \
  704.     sizeof(WORD))                   /* wId              */
  705.  
  706.  
  707. /*
  708.  * SubLanguage table structure.  This structure describes each entry of a
  709.  * sub language table.  These tables are pointed to by each entry in
  710.  * the language table.
  711.  */
  712. typedef struct {
  713.     WORD wSubLang;                  // SubLanguage value.
  714.     INT idsSubLang;                 // String id of SUBLANG_* define.
  715.     INT idsSubLangDesc;             // String id of sub-lang description.
  716. } SUBLANGTABLE, *PSUBLANGTABLE;
  717.  
  718. /*
  719.  * Language table structure.  This structure describes each entry in the
  720.  * language table, which describes each unicode language.
  721.  */
  722. typedef struct {
  723.     WORD wPrimary;                  // Language primary value.
  724.     INT idsLang;                    // String id of LANG_* define.
  725.     INT idsLangDesc;                // String id of language description.
  726.     INT cSubLangs;                  // Number of sublanguages for this lang.
  727.     PSUBLANGTABLE asl;              // Points to table of sublanguages.
  728. } LANGTABLE;
  729.  
  730.  
  731.  
  732.