home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / commdlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  41.2 KB  |  1,130 lines

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