home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / MSINC.PAK / COMMDLG.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  41KB  |  1,047 lines

  1. /*
  2.  *      C/C++ Run Time Library - Version 6.5
  3.  *
  4.  *      Copyright (c) 1994 by Borland International
  5.  *      All Rights Reserved.
  6.  *
  7.  */
  8.  
  9. #if !defined(__FLAT__)
  10. /*****************************************************************************\
  11. *                                                                             *
  12. * commdlg.h -   Common dialog functions, types, and definitions               *
  13. *                                                                             *
  14. \*****************************************************************************/
  15.  
  16. #ifndef __COMMDLG_H     /* prevent multiple includes */
  17. #define __COMMDLG_H
  18.  
  19. #ifndef __WINDOWS_H
  20. #include <windows.h>    /* <windows.h> must be included */
  21. #endif  /* __WINDOWS_H */
  22.  
  23. #ifndef RC_INVOKED
  24. #pragma option -a-      /* Assume byte packing throughout */
  25. #endif /* !RC_INVOKED */
  26.  
  27. #ifdef __cplusplus
  28. extern "C" {            /* Assume C declarations for C++ */
  29. #endif  /* __cplusplus */
  30.  
  31. /* If included with the 3.0 windows.h, define compatible aliases */
  32. #if !defined(WINVER) || (WINVER < 0x030a)
  33. #define WINAPI      FAR PASCAL
  34. #define CALLBACK    FAR PASCAL
  35. #define LPCSTR      LPSTR
  36. #define UINT        WORD
  37. #define LPARAM      LONG
  38. #define WPARAM      WORD
  39. #define LRESULT     LONG
  40. #define HMODULE     HANDLE
  41. #define HINSTANCE   HANDLE
  42. #define HLOCAL      HANDLE
  43. #define HGLOBAL     HANDLE
  44. #endif  /* WIN3.0 */
  45.  
  46. typedef struct tagOFN
  47. {
  48.     DWORD   lStructSize;
  49.     HWND    hwndOwner;
  50.     HINSTANCE hInstance;
  51.     LPCSTR  lpstrFilter;
  52.     LPSTR   lpstrCustomFilter;
  53.     DWORD   nMaxCustFilter;
  54.     DWORD   nFilterIndex;
  55.     LPSTR   lpstrFile;
  56.     DWORD   nMaxFile;
  57.     LPSTR   lpstrFileTitle;
  58.     DWORD   nMaxFileTitle;
  59.     LPCSTR  lpstrInitialDir;
  60.     LPCSTR  lpstrTitle;
  61.     DWORD   Flags;
  62.     UINT    nFileOffset;
  63.     UINT    nFileExtension;
  64.     LPCSTR  lpstrDefExt;
  65.     LPARAM  lCustData;
  66.     UINT    (CALLBACK *lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  67.     LPCSTR  lpTemplateName;
  68. }   OPENFILENAME;
  69. typedef OPENFILENAME FAR* LPOPENFILENAME;
  70.  
  71. BOOL    WINAPI GetOpenFileName(OPENFILENAME FAR*);
  72. BOOL    WINAPI GetSaveFileName(OPENFILENAME FAR*);
  73. int     WINAPI GetFileTitle(LPCSTR, LPSTR, UINT);
  74.  
  75. #define OFN_READONLY                 0x00000001L
  76. #define OFN_OVERWRITEPROMPT          0x00000002L
  77. #define OFN_HIDEREADONLY             0x00000004L
  78. #define OFN_NOCHANGEDIR              0x00000008L
  79. #define OFN_SHOWHELP                 0x00000010L
  80. #define OFN_ENABLEHOOK               0x00000020L
  81. #define OFN_ENABLETEMPLATE           0x00000040L
  82. #define OFN_ENABLETEMPLATEHANDLE     0x00000080L
  83. #define OFN_NOVALIDATE               0x00000100L
  84. #define OFN_ALLOWMULTISELECT         0x00000200L
  85. #define OFN_EXTENSIONDIFFERENT       0x00000400L
  86. #define OFN_PATHMUSTEXIST            0x00000800L
  87. #define OFN_FILEMUSTEXIST            0x00001000L
  88. #define OFN_CREATEPROMPT             0x00002000L
  89. #define OFN_SHAREAWARE               0x00004000L
  90. #define OFN_NOREADONLYRETURN         0x00008000L
  91. #define OFN_NOTESTFILECREATE         0x00010000L
  92.  
  93. /* Return values for the registered message sent to the hook function
  94.  * when a sharing violation occurs.  OFN_SHAREFALLTHROUGH allows the
  95.  * filename to be accepted, OFN_SHARENOWARN rejects the name but puts
  96.  * up no warning (returned when the app has already put up a warning
  97.  * message), and OFN_SHAREWARN puts up the default warning message
  98.  * for sharing violations.
  99.  *
  100.  * Note:  Undefined return values map to OFN_SHAREWARN, but are
  101.  *        reserved for future use.
  102.  */
  103.  
  104. #define OFN_SHAREFALLTHROUGH     2
  105. #define OFN_SHARENOWARN          1
  106. #define OFN_SHAREWARN            0
  107.  
  108. typedef struct tagCHOOSECOLOR
  109. {
  110.     DWORD   lStructSize;
  111.     HWND    hwndOwner;
  112.     HWND    hInstance;
  113.     COLORREF rgbResult;
  114.     COLORREF FAR* lpCustColors;
  115.     DWORD   Flags;
  116.     LPARAM  lCustData;
  117.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  118.     LPCSTR  lpTemplateName;
  119. } CHOOSECOLOR;
  120. typedef CHOOSECOLOR FAR *LPCHOOSECOLOR;
  121.  
  122. BOOL    WINAPI ChooseColor(CHOOSECOLOR FAR*);
  123.  
  124. #define CC_RGBINIT               0x00000001L
  125. #define CC_FULLOPEN              0x00000002L
  126. #define CC_PREVENTFULLOPEN       0x00000004L
  127. #define CC_SHOWHELP              0x00000008L
  128. #define CC_ENABLEHOOK            0x00000010L
  129. #define CC_ENABLETEMPLATE        0x00000020L
  130. #define CC_ENABLETEMPLATEHANDLE  0x00000040L
  131.  
  132. typedef struct tagFINDREPLACE
  133. {
  134.     DWORD    lStructSize;            /* size of this struct 0x20 */
  135.     HWND     hwndOwner;              /* handle to owner's window */
  136.     HINSTANCE hInstance;             /* instance handle of.EXE that
  137.                                       * contains cust. dlg. template
  138.                                       */
  139.     DWORD    Flags;                  /* one or more of the FR_?? */
  140.     LPSTR    lpstrFindWhat;          /* ptr. to search string    */
  141.     LPSTR    lpstrReplaceWith;       /* ptr. to replace string   */
  142.     UINT     wFindWhatLen;           /* size of find buffer      */
  143.     UINT     wReplaceWithLen;        /* size of replace buffer   */
  144.     LPARAM   lCustData;              /* data passed to hook fn.  */
  145.     UINT    (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  146.                                      /* ptr. to hook fn. or NULL */
  147.     LPCSTR   lpTemplateName;         /* custom template name     */
  148. } FINDREPLACE;
  149. typedef FINDREPLACE FAR *LPFINDREPLACE;
  150.  
  151. #define FR_DOWN                         0x00000001L
  152. #define FR_WHOLEWORD                    0x00000002L
  153. #define FR_MATCHCASE                    0x00000004L
  154. #define FR_FINDNEXT                     0x00000008L
  155. #define FR_REPLACE                      0x00000010L
  156. #define FR_REPLACEALL                   0x00000020L
  157. #define FR_DIALOGTERM                   0x00000040L
  158. #define FR_SHOWHELP                     0x00000080L
  159. #define FR_ENABLEHOOK                   0x00000100L
  160. #define FR_ENABLETEMPLATE               0x00000200L
  161. #define FR_NOUPDOWN                     0x00000400L
  162. #define FR_NOMATCHCASE                  0x00000800L
  163. #define FR_NOWHOLEWORD                  0x00001000L
  164. #define FR_ENABLETEMPLATEHANDLE         0x00002000L
  165. #define FR_HIDEUPDOWN                   0x00004000L
  166. #define FR_HIDEMATCHCASE                0x00008000L
  167. #define FR_HIDEWHOLEWORD                0x00010000L
  168.  
  169. HWND    WINAPI FindText(FINDREPLACE FAR*);
  170. HWND    WINAPI ReplaceText(FINDREPLACE FAR*);
  171.  
  172. typedef struct tagCHOOSEFONT
  173. {
  174.     DWORD           lStructSize;        /* */
  175.     HWND            hwndOwner;          /* caller's window handle   */
  176.     HDC             hDC;                /* printer DC/IC or NULL    */
  177.     LOGFONT FAR*    lpLogFont;          /* ptr. to a LOGFONT struct */
  178.     int             iPointSize;         /* 10 * size in points of selected font */
  179.     DWORD           Flags;              /* enum. type flags         */
  180.     COLORREF        rgbColors;          /* returned text color      */
  181.     LPARAM          lCustData;          /* data passed to hook fn.  */
  182.     UINT (CALLBACK* lpfnHook)(HWND, UINT, WPARAM, LPARAM);
  183.                                         /* ptr. to hook function    */
  184.     LPCSTR          lpTemplateName;     /* custom template name     */
  185.     HINSTANCE       hInstance;          /* instance handle of.EXE that
  186.                                          * contains cust. dlg. template
  187.                                          */
  188.     LPSTR           lpszStyle;          /* return the style field here
  189.                                          * must be LF_FACESIZE or bigger */
  190.     UINT            nFontType;          /* same value reported to the EnumFonts
  191.                                          * call back with the extra FONTTYPE_
  192.                                          * bits added */
  193.     int             nSizeMin;           /* minimum pt size allowed & */
  194.     int             nSizeMax;           /* max pt size allowed if    */
  195.                                         /* CF_LIMITSIZE is used      */
  196. } CHOOSEFONT;
  197. typedef CHOOSEFONT FAR *LPCHOOSEFONT;
  198.  
  199. BOOL WINAPI ChooseFont(CHOOSEFONT FAR*);
  200.  
  201. #define CF_SCREENFONTS               0x00000001L
  202. #define CF_PRINTERFONTS              0x00000002L
  203. #define CF_BOTH                      (CF_SCREENFONTS | CF_PRINTERFONTS)
  204. #define CF_SHOWHELP                  0x00000004L
  205. #define CF_ENABLEHOOK                0x00000008L
  206. #define CF_ENABLETEMPLATE            0x00000010L
  207. #define CF_ENABLETEMPLATEHANDLE      0x00000020L
  208. #define CF_INITTOLOGFONTSTRUCT       0x00000040L
  209. #define CF_USESTYLE                  0x00000080L
  210. #define CF_EFFECTS                   0x00000100L
  211. #define CF_APPLY                     0x00000200L
  212. #define CF_ANSIONLY                  0x00000400L
  213. #define CF_NOVECTORFONTS             0x00000800L
  214. #define CF_NOOEMFONTS                CF_NOVECTORFONTS
  215. #define CF_NOSIMULATIONS             0x00001000L
  216. #define CF_LIMITSIZE                 0x00002000L
  217. #define CF_FIXEDPITCHONLY            0x00004000L
  218. #define CF_WYSIWYG                   0x00008000L /* must also have CF_SCREENFONTS & CF_PRINTERFONTS */
  219. #define CF_FORCEFONTEXIST            0x00010000L
  220. #define CF_SCALABLEONLY              0x00020000L
  221. #define CF_TTONLY                    0x00040000L
  222. #define CF_NOFACESEL                 0x00080000L
  223. #define CF_NOSTYLESEL                0x00100000L
  224. #define CF_NOSIZESEL                 0x00200000L
  225.  
  226. /* these are extra nFontType bits that are added to what is returned to the
  227.  * EnumFonts callback routine */
  228.  
  229. #define SIMULATED_FONTTYPE      0x8000
  230. #define PRINTER_FONTTYPE        0x4000
  231. #define SCREEN_FONTTYPE         0x2000
  232. #define BOLD_FONTTYPE           0x0100
  233. #define ITALIC_FONTTYPE         0x0200
  234. #define REGULAR_FONTTYPE        0x0400
  235.  
  236. #define WM_CHOOSEFONT_GETLOGFONT        (WM_USER + 1)
  237.  
  238.  
  239. /* strings used to obtain unique window message for communication
  240.  * between dialog and caller
  241.  */
  242. #define LBSELCHSTRING  "commdlg_LBSelChangedNotify"
  243. #define SHAREVISTRING  "commdlg_ShareViolation"
  244. #define FILEOKSTRING   "commdlg_FileNameOK"
  245. #define COLOROKSTRING  "commdlg_ColorOK"
  246. #define SETRGBSTRING   "commdlg_SetRGBColor"
  247. #define FINDMSGSTRING  "commdlg_FindReplace"
  248. #define HELPMSGSTRING  "commdlg_help"
  249.  
  250. /* HIWORD values for lParam of commdlg_LBSelChangeNotify message */
  251. #define CD_LBSELNOITEMS -1
  252. #define CD_LBSELCHANGE   0
  253. #define CD_LBSELSUB      1
  254. #define CD_LBSELADD      2
  255.  
  256. typedef struct tagPD
  257. {
  258.     DWORD   lStructSize;
  259.     HWND    hwndOwner;
  260.     HGLOBAL hDevMode;
  261.     HGLOBAL hDevNames;
  262.     HDC     hDC;
  263.     DWORD   Flags;
  264.     UINT    nFromPage;
  265.     UINT    nToPage;
  266.     UINT    nMinPage;
  267.     UINT    nMaxPage;
  268.     UINT    nCopies;
  269.     HINSTANCE hInstance;
  270.     LPARAM  lCustData;
  271.     UINT    (CALLBACK* lpfnPrintHook)(HWND, UINT, WPARAM, LPARAM);
  272.     UINT    (CALLBACK* lpfnSetupHook)(HWND, UINT, WPARAM, LPARAM);
  273.     LPCSTR  lpPrintTemplateName;
  274.     LPCSTR  lpSetupTemplateName;
  275.     HGLOBAL hPrintTemplate;
  276.     HGLOBAL hSetupTemplate;
  277. } PRINTDLG;
  278. typedef PRINTDLG  FAR* LPPRINTDLG;
  279.  
  280. BOOL    WINAPI PrintDlg(PRINTDLG FAR*);
  281.  
  282. #define PD_ALLPAGES                  0x00000000L
  283. #define PD_SELECTION                 0x00000001L
  284. #define PD_PAGENUMS                  0x00000002L
  285. #define PD_NOSELECTION               0x00000004L
  286. #define PD_NOPAGENUMS                0x00000008L
  287. #define PD_COLLATE                   0x00000010L
  288. #define PD_PRINTTOFILE               0x00000020L
  289. #define PD_PRINTSETUP                0x00000040L
  290. #define PD_NOWARNING                 0x00000080L
  291. #define PD_RETURNDC                  0x00000100L
  292. #define PD_RETURNIC                  0x00000200L
  293. #define PD_RETURNDEFAULT             0x00000400L
  294. #define PD_SHOWHELP                  0x00000800L
  295. #define PD_ENABLEPRINTHOOK           0x00001000L
  296. #define PD_ENABLESETUPHOOK           0x00002000L
  297. #define PD_ENABLEPRINTTEMPLATE       0x00004000L
  298. #define PD_ENABLESETUPTEMPLATE       0x00008000L
  299. #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000L
  300. #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000L
  301. #define PD_USEDEVMODECOPIES          0x00040000L
  302. #define PD_DISABLEPRINTTOFILE        0x00080000L
  303. #define PD_HIDEPRINTTOFILE           0x00100000L
  304.  
  305. typedef struct tagDEVNAMES
  306. {
  307.     UINT wDriverOffset;
  308.     UINT wDeviceOffset;
  309.     UINT wOutputOffset;
  310.     UINT wDefault;
  311. } DEVNAMES;
  312. typedef DEVNAMES FAR* LPDEVNAMES;
  313.  
  314. #define DN_DEFAULTPRN      0x0001
  315.  
  316. DWORD   WINAPI CommDlgExtendedError(void);
  317.  
  318. #ifdef __cplusplus
  319. }                                                                /* end extern "C"  */
  320. #endif  /* __cplusplus */
  321.  
  322. #ifndef RC_INVOKED
  323. #pragma option -a.      /* Revert to default packing */
  324. #endif  /* RC_INVOKED */
  325.  
  326. #endif  /* __COMMDLG_H */
  327.  
  328. #else  /* __FLAT__ */
  329. /************************************************************************
  330. *                                                                       *
  331. *   commdlg.h -- This module defines the 32-Bit Common Dialog APIs      *
  332. *                                                                       *
  333. *   Copyright (c) 1992-1995, Microsoft Corp. All rights reserved.       *
  334. *                                                                       *
  335. ************************************************************************/
  336. #ifndef _INC_COMMDLG
  337. #define _INC_COMMDLG
  338.  
  339. #include <pshpack1.h>         /* Assume byte packing throughout */
  340.  
  341. #ifdef __cplusplus
  342. extern "C" {            /* Assume C declarations for C++ */
  343. #endif  /* __cplusplus */
  344.  
  345. #if(WINVER >= 0x0400)
  346. #ifdef __cplusplus
  347. #define SNDMSG ::SendMessage
  348. #else   /* __cplusplus */
  349. #define SNDMSG SendMessage
  350. #endif  /* __cplusplus */
  351. #endif /* WINVER >= 0x0400 */
  352.  
  353. typedef UINT (APIENTRY *LPOFNHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
  354.  
  355. typedef struct tagOFNA {
  356.    DWORD        lStructSize;
  357.    HWND         hwndOwner;
  358.    HINSTANCE    hInstance;
  359.    LPCSTR       lpstrFilter;
  360.    LPSTR        lpstrCustomFilter;
  361.    DWORD        nMaxCustFilter;
  362.    DWORD        nFilterIndex;
  363.    LPSTR        lpstrFile;
  364.    DWORD        nMaxFile;
  365.    LPSTR        lpstrFileTitle;
  366.    DWORD        nMaxFileTitle;
  367.    LPCSTR       lpstrInitialDir;
  368.    LPCSTR       lpstrTitle;
  369.    DWORD        Flags;
  370.    WORD         nFileOffset;
  371.    WORD         nFileExtension;
  372.    LPCSTR       lpstrDefExt;
  373.    LPARAM       lCustData;
  374.    LPOFNHOOKPROC lpfnHook;
  375.    LPCSTR       lpTemplateName;
  376. } OPENFILENAMEA, *LPOPENFILENAMEA;
  377. typedef struct tagOFNW {
  378.    DWORD        lStructSize;
  379.    HWND         hwndOwner;
  380.    HINSTANCE    hInstance;
  381.    LPCWSTR      lpstrFilter;
  382.    LPWSTR       lpstrCustomFilter;
  383.    DWORD        nMaxCustFilter;
  384.    DWORD        nFilterIndex;
  385.    LPWSTR       lpstrFile;
  386.    DWORD        nMaxFile;
  387.    LPWSTR       lpstrFileTitle;
  388.    DWORD        nMaxFileTitle;
  389.    LPCWSTR      lpstrInitialDir;
  390.    LPCWSTR      lpstrTitle;
  391.    DWORD        Flags;
  392.    WORD         nFileOffset;
  393.    WORD         nFileExtension;
  394.    LPCWSTR      lpstrDefExt;
  395.    LPARAM       lCustData;
  396.    LPOFNHOOKPROC lpfnHook;
  397.    LPCWSTR      lpTemplateName;
  398. } OPENFILENAMEW, *LPOPENFILENAMEW;
  399. #ifdef UNICODE
  400. typedef OPENFILENAMEW OPENFILENAME;
  401. typedef LPOPENFILENAMEW LPOPENFILENAME;
  402. #else
  403. typedef OPENFILENAMEA OPENFILENAME;
  404. typedef LPOPENFILENAMEA LPOPENFILENAME;
  405. #endif // UNICODE
  406.  
  407. BOOL  APIENTRY     GetOpenFileNameA(LPOPENFILENAMEA);
  408. BOOL  APIENTRY     GetOpenFileNameW(LPOPENFILENAMEW);
  409. #ifdef UNICODE
  410. #define GetOpenFileName  GetOpenFileNameW
  411. #else
  412. #define GetOpenFileName  GetOpenFileNameA
  413. #endif // !UNICODE
  414. BOOL  APIENTRY     GetSaveFileNameA(LPOPENFILENAMEA);
  415. BOOL  APIENTRY     GetSaveFileNameW(LPOPENFILENAMEW);
  416. #ifdef UNICODE
  417. #define GetSaveFileName  GetSaveFileNameW
  418. #else
  419. #define GetSaveFileName  GetSaveFileNameA
  420. #endif // !UNICODE
  421. short APIENTRY     GetFileTitleA(LPCSTR, LPSTR, WORD);
  422. short APIENTRY     GetFileTitleW(LPCWSTR, LPWSTR, WORD);
  423. #ifdef UNICODE
  424. #define GetFileTitle  GetFileTitleW
  425. #else
  426. #define GetFileTitle  GetFileTitleA
  427. #endif // !UNICODE
  428.  
  429. #define OFN_READONLY                 0x00000001
  430. #define OFN_OVERWRITEPROMPT          0x00000002
  431. #define OFN_HIDEREADONLY             0x00000004
  432. #define OFN_NOCHANGEDIR              0x00000008
  433. #define OFN_SHOWHELP                 0x00000010
  434. #define OFN_ENABLEHOOK               0x00000020
  435. #define OFN_ENABLETEMPLATE           0x00000040
  436. #define OFN_ENABLETEMPLATEHANDLE     0x00000080
  437. #define OFN_NOVALIDATE               0x00000100
  438. #define OFN_ALLOWMULTISELECT         0x00000200
  439. #define OFN_EXTENSIONDIFFERENT       0x00000400
  440. #define OFN_PATHMUSTEXIST            0x00000800
  441. #define OFN_FILEMUSTEXIST            0x00001000
  442. #define OFN_CREATEPROMPT             0x00002000
  443. #define OFN_SHAREAWARE               0x00004000
  444. #define OFN_NOREADONLYRETURN         0x00008000
  445. #define OFN_NOTESTFILECREATE         0x00010000
  446. #define OFN_NONETWORKBUTTON          0x00020000
  447. #define OFN_NOLONGNAMES              0x00040000     // force no long names for 4.x modules
  448. #if(WINVER >= 0x0400)
  449. #define OFN_EXPLORER                 0x00080000     // new look commdlg
  450. #define OFN_NODEREFERENCELINKS       0x00100000
  451. #define OFN_LONGNAMES                0x00200000     // force long names for 3.x modules
  452. #endif /* WINVER >= 0x0400 */
  453.  
  454. // Return values for the registered message sent to the hook function
  455. // when a sharing violation occurs.  OFN_SHAREFALLTHROUGH allows the
  456. // filename to be accepted, OFN_SHARENOWARN rejects the name but puts
  457. // up no warning (returned when the app has already put up a warning
  458. // message), and OFN_SHAREWARN puts up the default warning message
  459. // for sharing violations.
  460. //
  461. // Note:  Undefined return values map to OFN_SHAREWARN, but are
  462. //        reserved for future use.
  463.  
  464. #define OFN_SHAREFALLTHROUGH     2
  465. #define OFN_SHARENOWARN          1
  466. #define OFN_SHAREWARN            0
  467.  
  468. typedef UINT (APIENTRY *LPCCHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
  469.  
  470. #if(WINVER >= 0x0400)
  471. // Structure used for all OpenFileName notifications
  472. typedef struct _OFNOTIFYA
  473. {
  474.         NMHDR           hdr;
  475.         LPOPENFILENAMEA lpOFN;
  476.         LPSTR           pszFile;        // May be NULL
  477. } OFNOTIFYA, FAR *LPOFNOTIFYA;
  478. // Structure used for all OpenFileName notifications
  479. typedef struct _OFNOTIFYW
  480. {
  481.         NMHDR           hdr;
  482.         LPOPENFILENAMEW lpOFN;
  483.         LPWSTR          pszFile;        // May be NULL
  484. } OFNOTIFYW, FAR *LPOFNOTIFYW;
  485. #ifdef UNICODE
  486. typedef OFNOTIFYW OFNOTIFY;
  487. typedef LPOFNOTIFYW LPOFNOTIFY;
  488. #else
  489. typedef OFNOTIFYA OFNOTIFY;
  490. typedef LPOFNOTIFYA LPOFNOTIFY;
  491. #endif // UNICODE
  492.  
  493. #define CDN_FIRST   (0U-601U)
  494. #define CDN_LAST    (0U-699U)
  495.  
  496. // Notifications when Open or Save dialog status changes
  497. #define CDN_INITDONE            (CDN_FIRST - 0x0000)
  498. #define CDN_SELCHANGE           (CDN_FIRST - 0x0001)
  499. #define CDN_FOLDERCHANGE        (CDN_FIRST - 0x0002)
  500. #define CDN_SHAREVIOLATION      (CDN_FIRST - 0x0003)
  501. #define CDN_HELP                (CDN_FIRST - 0x0004)
  502. #define CDN_FILEOK              (CDN_FIRST - 0x0005)
  503. #define CDN_TYPECHANGE          (CDN_FIRST - 0x0006)
  504.  
  505. #define CDM_FIRST       (WM_USER + 100)
  506. #define CDM_LAST        (WM_USER + 200)
  507.  
  508. // Messages to query information from the Open or Save dialogs
  509.  
  510. // lParam = pointer to text buffer that gets filled in
  511. // wParam = max number of characters of the text buffer (including NULL)
  512. // return = < 0 if error; number of characters needed (including NULL)
  513. #define CDM_GETSPEC             (CDM_FIRST + 0x0000)
  514. #define CommDlg_OpenSave_GetSpecA(_hdlg, _psz, _cbmax) \
  515.         (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
  516. #define CommDlg_OpenSave_GetSpecW(_hdlg, _psz, _cbmax) \
  517.         (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
  518. #ifdef UNICODE
  519. #define CommDlg_OpenSave_GetSpec  CommDlg_OpenSave_GetSpecW
  520. #else
  521. #define CommDlg_OpenSave_GetSpec  CommDlg_OpenSave_GetSpecA
  522. #endif // !UNICODE
  523.  
  524. // lParam = pointer to text buffer that gets filled in
  525. // wParam = max number of characters of the text buffer (including NULL)
  526. // return = < 0 if error; number of characters needed (including NULL)
  527. #define CDM_GETFILEPATH         (CDM_FIRST + 0x0001)
  528. #define CommDlg_OpenSave_GetFilePathA(_hdlg, _psz, _cbmax) \
  529.         (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
  530. #define CommDlg_OpenSave_GetFilePathW(_hdlg, _psz, _cbmax) \
  531.         (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
  532. #ifdef UNICODE
  533. #define CommDlg_OpenSave_GetFilePath  CommDlg_OpenSave_GetFilePathW
  534. #else
  535. #define CommDlg_OpenSave_GetFilePath  CommDlg_OpenSave_GetFilePathA
  536. #endif // !UNICODE
  537.  
  538. // lParam = pointer to text buffer that gets filled in
  539. // wParam = max number of characters of the text buffer (including NULL)
  540. // return = < 0 if error; number of characters needed (including NULL)
  541. #define CDM_GETFOLDERPATH       (CDM_FIRST + 0x0002)
  542. #define CommDlg_OpenSave_GetFolderPathA(_hdlg, _psz, _cbmax) \
  543.         (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
  544. #define CommDlg_OpenSave_GetFolderPathW(_hdlg, _psz, _cbmax) \
  545.         (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
  546. #ifdef UNICODE
  547. #define CommDlg_OpenSave_GetFolderPath  CommDlg_OpenSave_GetFolderPathW
  548. #else
  549. #define CommDlg_OpenSave_GetFolderPath  CommDlg_OpenSave_GetFolderPathA
  550. #endif // !UNICODE
  551.  
  552. // lParam = pointer to ITEMIDLIST buffer that gets filled in
  553. // wParam = size of the ITEMIDLIST buffer
  554. // return = < 0 if error; length of buffer needed
  555. #define CDM_GETFOLDERIDLIST     (CDM_FIRST + 0x0003)
  556. #define CommDlg_OpenSave_GetFolderIDList(_hdlg, _pidl, _cbmax) \
  557.         (int)SNDMSG(_hdlg, CDM_GETFOLDERIDLIST, (WPARAM)_cbmax, (LPARAM)(LPVOID)_pidl)
  558.  
  559. // lParam = pointer to a string
  560. // wParam = ID of control to change
  561. // return = not used
  562. #define CDM_SETCONTROLTEXT      (CDM_FIRST + 0x0004)
  563. #define CommDlg_OpenSave_SetControlText(_hdlg, _id, _text) \
  564.         (void)SNDMSG(_hdlg, CDM_SETCONTROLTEXT, (WPARAM)_id, (LPARAM)(LPSTR)_text)
  565.  
  566. // lParam = not used
  567. // wParam = ID of control to change
  568. // return = not used
  569. #define CDM_HIDECONTROL         (CDM_FIRST + 0x0005)
  570. #define CommDlg_OpenSave_HideControl(_hdlg, _id) \
  571.         (void)SNDMSG(_hdlg, CDM_HIDECONTROL, (WPARAM)_id, 0)
  572.  
  573. // lParam = pointer to default extension (no dot)
  574. // wParam = not used
  575. // return = not used
  576. #define CDM_SETDEFEXT           (CDM_FIRST + 0x0006)
  577. #define CommDlg_OpenSave_SetDefExt(_hdlg, _pszext) \
  578.         (void)SNDMSG(_hdlg, CDM_SETDEFEXT, 0, (LPARAM)(LPSTR)_pszext)
  579. #endif /* WINVER >= 0x0400 */
  580.  
  581. typedef struct tagCHOOSECOLORA {
  582.    DWORD        lStructSize;
  583.    HWND         hwndOwner;
  584.    HWND         hInstance;
  585.    COLORREF     rgbResult;
  586.    COLORREF*    lpCustColors;
  587.    DWORD        Flags;
  588.    LPARAM       lCustData;
  589.    LPCCHOOKPROC lpfnHook;
  590.    LPCSTR       lpTemplateName;
  591. } CHOOSECOLORA, *LPCHOOSECOLORA;
  592. typedef struct tagCHOOSECOLORW {
  593.    DWORD        lStructSize;
  594.    HWND         hwndOwner;
  595.    HWND         hInstance;
  596.    COLORREF     rgbResult;
  597.    COLORREF*    lpCustColors;
  598.    DWORD        Flags;
  599.    LPARAM       lCustData;
  600.    LPCCHOOKPROC lpfnHook;
  601.    LPCWSTR      lpTemplateName;
  602. } CHOOSECOLORW, *LPCHOOSECOLORW;
  603. #ifdef UNICODE
  604. typedef CHOOSECOLORW CHOOSECOLOR;
  605. typedef LPCHOOSECOLORW LPCHOOSECOLOR;
  606. #else
  607. typedef CHOOSECOLORA CHOOSECOLOR;
  608. typedef LPCHOOSECOLORA LPCHOOSECOLOR;
  609. #endif // UNICODE
  610.  
  611. BOOL  APIENTRY ChooseColorA(LPCHOOSECOLORA);
  612. BOOL  APIENTRY ChooseColorW(LPCHOOSECOLORW);
  613. #ifdef UNICODE
  614. #define ChooseColor  ChooseColorW
  615. #else
  616. #define ChooseColor  ChooseColorA
  617. #endif // !UNICODE
  618.  
  619. #define CC_RGBINIT               0x00000001
  620. #define CC_FULLOPEN              0x00000002
  621. #define CC_PREVENTFULLOPEN       0x00000004
  622. #define CC_SHOWHELP              0x00000008
  623. #define CC_ENABLEHOOK            0x00000010
  624. #define CC_ENABLETEMPLATE        0x00000020
  625. #define CC_ENABLETEMPLATEHANDLE  0x00000040
  626. #if(WINVER >= 0x0400)
  627. #define CC_SOLIDCOLOR            0x00000080
  628. #define CC_ANYCOLOR              0x00000100
  629. #endif /* WINVER >= 0x0400 */
  630.  
  631. typedef UINT (APIENTRY *LPFRHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
  632.  
  633. typedef struct tagFINDREPLACEA {
  634.    DWORD        lStructSize;        // size of this struct 0x20
  635.    HWND         hwndOwner;          // handle to owner's window
  636.    HINSTANCE    hInstance;          // instance handle of.EXE that
  637.                                     //   contains cust. dlg. template
  638.    DWORD        Flags;              // one or more of the FR_??
  639.    LPSTR        lpstrFindWhat;      // ptr. to search string
  640.    LPSTR        lpstrReplaceWith;   // ptr. to replace string
  641.    WORD         wFindWhatLen;       // size of find buffer
  642.    WORD         wReplaceWithLen;    // size of replace buffer
  643.    LPARAM       lCustData;          // data passed to hook fn.
  644.    LPFRHOOKPROC lpfnHook;           // ptr. to hook fn. or NULL
  645.    LPCSTR       lpTemplateName;     // custom template name
  646. } FINDREPLACEA, *LPFINDREPLACEA;
  647. typedef struct tagFINDREPLACEW {
  648.    DWORD        lStructSize;        // size of this struct 0x20
  649.    HWND         hwndOwner;          // handle to owner's window
  650.    HINSTANCE    hInstance;          // instance handle of.EXE that
  651.                                     //   contains cust. dlg. template
  652.    DWORD        Flags;              // one or more of the FR_??
  653.    LPWSTR       lpstrFindWhat;      // ptr. to search string
  654.    LPWSTR       lpstrReplaceWith;   // ptr. to replace string
  655.    WORD         wFindWhatLen;       // size of find buffer
  656.    WORD         wReplaceWithLen;    // size of replace buffer
  657.    LPARAM       lCustData;          // data passed to hook fn.
  658.    LPFRHOOKPROC lpfnHook;           // ptr. to hook fn. or NULL
  659.    LPCWSTR      lpTemplateName;     // custom template name
  660. } FINDREPLACEW, *LPFINDREPLACEW;
  661. #ifdef UNICODE
  662. typedef FINDREPLACEW FINDREPLACE;
  663. typedef LPFINDREPLACEW LPFINDREPLACE;
  664. #else
  665. typedef FINDREPLACEA FINDREPLACE;
  666. typedef LPFINDREPLACEA LPFINDREPLACE;
  667. #endif // UNICODE
  668.  
  669. #define FR_DOWN                         0x00000001
  670. #define FR_WHOLEWORD                    0x00000002
  671. #define FR_MATCHCASE                    0x00000004
  672. #define FR_FINDNEXT                     0x00000008
  673. #define FR_REPLACE                      0x00000010
  674. #define FR_REPLACEALL                   0x00000020
  675. #define FR_DIALOGTERM                   0x00000040
  676. #define FR_SHOWHELP                     0x00000080
  677. #define FR_ENABLEHOOK                   0x00000100
  678. #define FR_ENABLETEMPLATE               0x00000200
  679. #define FR_NOUPDOWN                     0x00000400
  680. #define FR_NOMATCHCASE                  0x00000800
  681. #define FR_NOWHOLEWORD                  0x00001000
  682. #define FR_ENABLETEMPLATEHANDLE         0x00002000
  683. #define FR_HIDEUPDOWN                   0x00004000
  684. #define FR_HIDEMATCHCASE                0x00008000
  685. #define FR_HIDEWHOLEWORD                0x00010000
  686.  
  687. HWND  APIENTRY    FindTextA(LPFINDREPLACEA);
  688. HWND  APIENTRY    FindTextW(LPFINDREPLACEW);
  689. #ifdef UNICODE
  690. #define FindText  FindTextW
  691. #else
  692. #define FindText  FindTextA
  693. #endif // !UNICODE
  694. HWND  APIENTRY    ReplaceTextA(LPFINDREPLACEA);
  695. HWND  APIENTRY    ReplaceTextW(LPFINDREPLACEW);
  696. #ifdef UNICODE
  697. #define ReplaceText  ReplaceTextW
  698. #else
  699. #define ReplaceText  ReplaceTextA
  700. #endif // !UNICODE
  701.  
  702. typedef UINT (APIENTRY *LPCFHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
  703.  
  704. typedef struct tagCHOOSEFONTA {
  705.    DWORD           lStructSize;
  706.    HWND            hwndOwner;          // caller's window handle
  707.    HDC             hDC;                // printer DC/IC or NULL
  708.    LPLOGFONTA      lpLogFont;          // ptr. to a LOGFONT struct
  709.    INT             iPointSize;         // 10 * size in points of selected font
  710.    DWORD           Flags;              // enum. type flags
  711.    COLORREF        rgbColors;          // returned text color
  712.    LPARAM          lCustData;          // data passed to hook fn.
  713.    LPCFHOOKPROC    lpfnHook;           // ptr. to hook function
  714.    LPCSTR          lpTemplateName;     // custom template name
  715.    HINSTANCE       hInstance;          // instance handle of.EXE that
  716.                                        //   contains cust. dlg. template
  717.    LPSTR           lpszStyle;          // return the style field here
  718.                                        // must be LF_FACESIZE or bigger
  719.    WORD            nFontType;          // same value reported to the EnumFonts
  720.                                        //   call back with the extra FONTTYPE_
  721.                                        //   bits added
  722.    WORD            ___MISSING_ALIGNMENT__;
  723.    INT             nSizeMin;           // minimum pt size allowed &
  724.    INT             nSizeMax;           // max pt size allowed if
  725.                                        //   CF_LIMITSIZE is used
  726. } CHOOSEFONTA, *LPCHOOSEFONTA;
  727. typedef struct tagCHOOSEFONTW {
  728.    DWORD           lStructSize;
  729.    HWND            hwndOwner;          // caller's window handle
  730.    HDC             hDC;                // printer DC/IC or NULL
  731.    LPLOGFONTW      lpLogFont;          // ptr. to a LOGFONT struct
  732.    INT             iPointSize;         // 10 * size in points of selected font
  733.    DWORD           Flags;              // enum. type flags
  734.    COLORREF        rgbColors;          // returned text color
  735.    LPARAM          lCustData;          // data passed to hook fn.
  736.    LPCFHOOKPROC    lpfnHook;           // ptr. to hook function
  737.    LPCWSTR         lpTemplateName;     // custom template name
  738.    HINSTANCE       hInstance;          // instance handle of.EXE that
  739.                                        //   contains cust. dlg. template
  740.    LPWSTR          lpszStyle;          // return the style field here
  741.                                        // must be LF_FACESIZE or bigger
  742.    WORD            nFontType;          // same value reported to the EnumFonts
  743.                                        //   call back with the extra FONTTYPE_
  744.                                        //   bits added
  745.    WORD            ___MISSING_ALIGNMENT__;
  746.    INT             nSizeMin;           // minimum pt size allowed &
  747.    INT             nSizeMax;           // max pt size allowed if
  748.                                        //   CF_LIMITSIZE is used
  749. } CHOOSEFONTW, *LPCHOOSEFONTW;
  750. #ifdef UNICODE
  751. typedef CHOOSEFONTW CHOOSEFONT;
  752. typedef LPCHOOSEFONTW LPCHOOSEFONT;
  753. #else
  754. typedef CHOOSEFONTA CHOOSEFONT;
  755. typedef LPCHOOSEFONTA LPCHOOSEFONT;
  756. #endif // UNICODE
  757.  
  758. BOOL APIENTRY ChooseFontA(LPCHOOSEFONTA);
  759. BOOL APIENTRY ChooseFontW(LPCHOOSEFONTW);
  760. #ifdef UNICODE
  761. #define ChooseFont  ChooseFontW
  762. #else
  763. #define ChooseFont  ChooseFontA
  764. #endif // !UNICODE
  765.  
  766. #define CF_SCREENFONTS             0x00000001
  767. #define CF_PRINTERFONTS            0x00000002
  768. #define CF_BOTH                    (CF_SCREENFONTS | CF_PRINTERFONTS)
  769. #define CF_SHOWHELP                0x00000004L
  770. #define CF_ENABLEHOOK              0x00000008L
  771. #define CF_ENABLETEMPLATE          0x00000010L
  772. #define CF_ENABLETEMPLATEHANDLE    0x00000020L
  773. #define CF_INITTOLOGFONTSTRUCT     0x00000040L
  774. #define CF_USESTYLE                0x00000080L
  775. #define CF_EFFECTS                 0x00000100L
  776. #define CF_APPLY                   0x00000200L
  777. #define CF_ANSIONLY                0x00000400L
  778. #if(WINVER >= 0x0400)
  779. #define CF_SCRIPTSONLY             CF_ANSIONLY
  780. #endif /* WINVER >= 0x0400 */
  781. #define CF_NOVECTORFONTS           0x00000800L
  782. #define CF_NOOEMFONTS              CF_NOVECTORFONTS
  783. #define CF_NOSIMULATIONS           0x00001000L
  784. #define CF_LIMITSIZE               0x00002000L
  785. #define CF_FIXEDPITCHONLY          0x00004000L
  786. #define CF_WYSIWYG                 0x00008000L // must also have CF_SCREENFONTS & CF_PRINTERFONTS
  787. #define CF_FORCEFONTEXIST          0x00010000L
  788. #define CF_SCALABLEONLY            0x00020000L
  789. #define CF_TTONLY                  0x00040000L
  790. #define CF_NOFACESEL               0x00080000L
  791. #define CF_NOSTYLESEL              0x00100000L
  792. #define CF_NOSIZESEL               0x00200000L
  793. #if(WINVER >= 0x0400)
  794. #define CF_SELECTSCRIPT            0x00400000L
  795. #define CF_NOSCRIPTSEL             0x00800000L
  796. #define CF_NOVERTFONTS             0x01000000L
  797. #endif /* WINVER >= 0x0400 */
  798.  
  799. // these are extra nFontType bits that are added to what is returned to the
  800. // EnumFonts callback routine
  801.  
  802. #define SIMULATED_FONTTYPE    0x8000
  803. #define PRINTER_FONTTYPE      0x4000
  804. #define SCREEN_FONTTYPE       0x2000
  805. #define BOLD_FONTTYPE         0x0100
  806. #define ITALIC_FONTTYPE       0x0200
  807. #define REGULAR_FONTTYPE      0x0400
  808.  
  809. #define WM_CHOOSEFONT_GETLOGFONT      (WM_USER + 1)
  810. #define WM_CHOOSEFONT_SETLOGFONT      (WM_USER + 101)
  811. #define WM_CHOOSEFONT_SETFLAGS        (WM_USER + 102)
  812.  
  813. // strings used to obtain unique window message for communication
  814. // between dialog and caller
  815.  
  816. #define LBSELCHSTRINGA  "commdlg_LBSelChangedNotify"
  817. #define SHAREVISTRINGA  "commdlg_ShareViolation"
  818. #define FILEOKSTRINGA   "commdlg_FileNameOK"
  819. #define COLOROKSTRINGA  "commdlg_ColorOK"
  820. #define SETRGBSTRINGA   "commdlg_SetRGBColor"
  821. #define HELPMSGSTRINGA  "commdlg_help"
  822. #define FINDMSGSTRINGA  "commdlg_FindReplace"
  823.  
  824. #define LBSELCHSTRINGW  L"commdlg_LBSelChangedNotify"
  825. #define SHAREVISTRINGW  L"commdlg_ShareViolation"
  826. #define FILEOKSTRINGW   L"commdlg_FileNameOK"
  827. #define COLOROKSTRINGW  L"commdlg_ColorOK"
  828. #define SETRGBSTRINGW   L"commdlg_SetRGBColor"
  829. #define HELPMSGSTRINGW  L"commdlg_help"
  830. #define FINDMSGSTRINGW  L"commdlg_FindReplace"
  831.  
  832. #ifdef UNICODE
  833. #define LBSELCHSTRING  LBSELCHSTRINGW
  834. #define SHAREVISTRING  SHAREVISTRINGW
  835. #define FILEOKSTRING   FILEOKSTRINGW
  836. #define COLOROKSTRING  COLOROKSTRINGW
  837. #define SETRGBSTRING   SETRGBSTRINGW
  838. #define HELPMSGSTRING  HELPMSGSTRINGW
  839. #define FINDMSGSTRING  FINDMSGSTRINGW
  840. #else
  841. #define LBSELCHSTRING  LBSELCHSTRINGA
  842. #define SHAREVISTRING  SHAREVISTRINGA
  843. #define FILEOKSTRING   FILEOKSTRINGA
  844. #define COLOROKSTRING  COLOROKSTRINGA
  845. #define SETRGBSTRING   SETRGBSTRINGA
  846. #define HELPMSGSTRING  HELPMSGSTRINGA
  847. #define FINDMSGSTRING  FINDMSGSTRINGA
  848. #endif
  849.  
  850. // HIWORD values for lParam of commdlg_LBSelChangeNotify message
  851. #define CD_LBSELNOITEMS -1
  852. #define CD_LBSELCHANGE   0
  853. #define CD_LBSELSUB      1
  854. #define CD_LBSELADD      2
  855.  
  856. typedef UINT (APIENTRY *LPPRINTHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
  857. typedef UINT (APIENTRY *LPSETUPHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
  858.  
  859. typedef struct tagPDA {
  860.    DWORD            lStructSize;
  861.    HWND             hwndOwner;
  862.    HGLOBAL          hDevMode;
  863.    HGLOBAL          hDevNames;
  864.    HDC              hDC;
  865.    DWORD            Flags;
  866.    WORD             nFromPage;
  867.    WORD             nToPage;
  868.    WORD             nMinPage;
  869.    WORD             nMaxPage;
  870.    WORD             nCopies;
  871.    HINSTANCE        hInstance;
  872.    LPARAM           lCustData;
  873.    LPPRINTHOOKPROC  lpfnPrintHook;
  874.    LPSETUPHOOKPROC  lpfnSetupHook;
  875.    LPCSTR           lpPrintTemplateName;
  876.    LPCSTR           lpSetupTemplateName;
  877.    HGLOBAL          hPrintTemplate;
  878.    HGLOBAL          hSetupTemplate;
  879. } PRINTDLGA, *LPPRINTDLGA;
  880. typedef struct tagPDW {
  881.    DWORD            lStructSize;
  882.    HWND             hwndOwner;
  883.    HGLOBAL          hDevMode;
  884.    HGLOBAL          hDevNames;
  885.    HDC              hDC;
  886.    DWORD            Flags;
  887.    WORD             nFromPage;
  888.    WORD             nToPage;
  889.    WORD             nMinPage;
  890.    WORD             nMaxPage;
  891.    WORD             nCopies;
  892.    HINSTANCE        hInstance;
  893.    LPARAM           lCustData;
  894.    LPPRINTHOOKPROC  lpfnPrintHook;
  895.    LPSETUPHOOKPROC  lpfnSetupHook;
  896.    LPCWSTR          lpPrintTemplateName;
  897.    LPCWSTR          lpSetupTemplateName;
  898.    HGLOBAL          hPrintTemplate;
  899.    HGLOBAL          hSetupTemplate;
  900. } PRINTDLGW, *LPPRINTDLGW;
  901. #ifdef UNICODE
  902. typedef PRINTDLGW PRINTDLG;
  903. typedef LPPRINTDLGW LPPRINTDLG;
  904. #else
  905. typedef PRINTDLGA PRINTDLG;
  906. typedef LPPRINTDLGA LPPRINTDLG;
  907. #endif // UNICODE
  908.  
  909. BOOL  APIENTRY     PrintDlgA(LPPRINTDLGA);
  910. BOOL  APIENTRY     PrintDlgW(LPPRINTDLGW);
  911. #ifdef UNICODE
  912. #define PrintDlg  PrintDlgW
  913. #else
  914. #define PrintDlg  PrintDlgA
  915. #endif // !UNICODE
  916.  
  917. #define PD_ALLPAGES                  0x00000000
  918. #define PD_SELECTION                 0x00000001
  919. #define PD_PAGENUMS                  0x00000002
  920. #define PD_NOSELECTION               0x00000004
  921. #define PD_NOPAGENUMS                0x00000008
  922. #define PD_COLLATE                   0x00000010
  923. #define PD_PRINTTOFILE               0x00000020
  924. #define PD_PRINTSETUP                0x00000040
  925. #define PD_NOWARNING                 0x00000080
  926. #define PD_RETURNDC                  0x00000100
  927. #define PD_RETURNIC                  0x00000200
  928. #define PD_RETURNDEFAULT             0x00000400
  929. #define PD_SHOWHELP                  0x00000800
  930. #define PD_ENABLEPRINTHOOK           0x00001000
  931. #define PD_ENABLESETUPHOOK           0x00002000
  932. #define PD_ENABLEPRINTTEMPLATE       0x00004000
  933. #define PD_ENABLESETUPTEMPLATE       0x00008000
  934. #define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000
  935. #define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000
  936. #define PD_USEDEVMODECOPIES          0x00040000
  937. #define PD_USEDEVMODECOPIESANDCOLLATE 0x00040000
  938. #define PD_DISABLEPRINTTOFILE        0x00080000
  939. #define PD_HIDEPRINTTOFILE           0x00100000
  940. #define PD_NONETWORKBUTTON           0x00200000
  941.  
  942. typedef struct tagDEVNAMES {
  943.    WORD wDriverOffset;
  944.    WORD wDeviceOffset;
  945.    WORD wOutputOffset;
  946.    WORD wDefault;
  947. } DEVNAMES;
  948.  
  949. typedef DEVNAMES * LPDEVNAMES;
  950.  
  951. #define DN_DEFAULTPRN      0x0001
  952.  
  953. DWORD APIENTRY     CommDlgExtendedError(VOID);
  954.  
  955. #if(WINVER >= 0x0400)
  956. #define WM_PSD_PAGESETUPDLG     (WM_USER  )
  957. #define WM_PSD_FULLPAGERECT     (WM_USER+1)
  958. #define WM_PSD_MINMARGINRECT    (WM_USER+2)
  959. #define WM_PSD_MARGINRECT       (WM_USER+3)
  960. #define WM_PSD_GREEKTEXTRECT    (WM_USER+4)
  961. #define WM_PSD_ENVSTAMPRECT     (WM_USER+5)
  962. #define WM_PSD_YAFULLPAGERECT   (WM_USER+6)
  963.  
  964. typedef UINT (APIENTRY* LPPAGEPAINTHOOK)( HWND, UINT, WPARAM, LPARAM );
  965. typedef UINT (APIENTRY* LPPAGESETUPHOOK)( HWND, UINT, WPARAM, LPARAM );
  966.  
  967. typedef struct tagPSDA
  968. {
  969.     DWORD           lStructSize;
  970.     HWND            hwndOwner;
  971.     HGLOBAL         hDevMode;
  972.     HGLOBAL         hDevNames;
  973.     DWORD           Flags;
  974.     POINT           ptPaperSize;
  975.     RECT            rtMinMargin;
  976.     RECT            rtMargin;
  977.     HINSTANCE       hInstance;
  978.     LPARAM          lCustData;
  979.     LPPAGESETUPHOOK lpfnPageSetupHook;
  980.     LPPAGEPAINTHOOK lpfnPagePaintHook;
  981.     LPCSTR          lpPageSetupTemplateName;
  982.     HGLOBAL         hPageSetupTemplate;
  983. } PAGESETUPDLGA, * LPPAGESETUPDLGA;
  984. typedef struct tagPSDW
  985. {
  986.     DWORD           lStructSize;
  987.     HWND            hwndOwner;
  988.     HGLOBAL         hDevMode;
  989.     HGLOBAL         hDevNames;
  990.     DWORD           Flags;
  991.     POINT           ptPaperSize;
  992.     RECT            rtMinMargin;
  993.     RECT            rtMargin;
  994.     HINSTANCE       hInstance;
  995.     LPARAM          lCustData;
  996.     LPPAGESETUPHOOK lpfnPageSetupHook;
  997.     LPPAGEPAINTHOOK lpfnPagePaintHook;
  998.     LPCWSTR         lpPageSetupTemplateName;
  999.     HGLOBAL         hPageSetupTemplate;
  1000. } PAGESETUPDLGW, * LPPAGESETUPDLGW;
  1001. #ifdef UNICODE
  1002. typedef PAGESETUPDLGW PAGESETUPDLG;
  1003. typedef LPPAGESETUPDLGW LPPAGESETUPDLG;
  1004. #else
  1005. typedef PAGESETUPDLGA PAGESETUPDLG;
  1006. typedef LPPAGESETUPDLGA LPPAGESETUPDLG;
  1007. #endif // UNICODE
  1008.  
  1009. BOOL APIENTRY PageSetupDlgA( LPPAGESETUPDLGA );
  1010. BOOL APIENTRY PageSetupDlgW( LPPAGESETUPDLGW );
  1011. #ifdef UNICODE
  1012. #define PageSetupDlg  PageSetupDlgW
  1013. #else
  1014. #define PageSetupDlg  PageSetupDlgA
  1015. #endif // !UNICODE
  1016.  
  1017. #define PSD_DEFAULTMINMARGINS             0x00000000 // default (printer's)
  1018. #define PSD_INWININIINTLMEASURE           0x00000000 // 1st of 4 possible
  1019.  
  1020. #define PSD_MINMARGINS                    0x00000001 // use caller's
  1021. #define PSD_MARGINS                       0x00000002 // use caller's
  1022. #define PSD_INTHOUSANDTHSOFINCHES         0x00000004 // 2nd of 4 possible
  1023. #define PSD_INHUNDREDTHSOFMILLIMETERS     0x00000008 // 3rd of 4 possible
  1024. #define PSD_DISABLEMARGINS                0x00000010
  1025. #define PSD_DISABLEPRINTER                0x00000020
  1026. #define PSD_NOWARNING                     0x00000080 // must be same as PD_*
  1027. #define PSD_DISABLEORIENTATION            0x00000100
  1028. #define PSD_RETURNDEFAULT                 0x00000400 // must be same as PD_*
  1029. #define PSD_DISABLEPAPER                  0x00000200
  1030. #define PSD_SHOWHELP                      0x00000800 // must be same as PD_*
  1031. #define PSD_ENABLEPAGESETUPHOOK           0x00002000 // must be same as PD_*
  1032. #define PSD_ENABLEPAGESETUPTEMPLATE       0x00008000 // must be same as PD_*
  1033. #define PSD_ENABLEPAGESETUPTEMPLATEHANDLE 0x00020000 // must be same as PD_*
  1034. #define PSD_ENABLEPAGEPAINTHOOK           0x00040000
  1035. #define PSD_DISABLEPAGEPAINTING           0x00080000
  1036. #endif /* WINVER >= 0x0400 */
  1037.  
  1038. #ifdef __cplusplus
  1039. }
  1040. #endif  /* __cplusplus */
  1041.  
  1042. #include <poppack.h>
  1043. #endif  /* !_INC_COMMDLG */
  1044.  
  1045.  
  1046. #endif  /* __FLAT__ */
  1047.