home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / prsht.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  16KB  |  520 lines

  1.  
  2. /*****************************************************************************\
  3. *                                                                             *
  4. * prsht.h - - Interface for the Windows Property Sheet Pages                  *
  5. *                                                                             *
  6. * Version 1.0                                                                 *
  7. *                                                                             *
  8. * Copyright 1991-1998, Microsoft Corp.      All rights reserved.          *
  9. *                                                                             *
  10. \*****************************************************************************/
  11.  
  12. #ifndef _PRSHT_H_
  13. #define _PRSHT_H_
  14.  
  15. #ifndef _WIN32_IE
  16. #define _WIN32_IE 0x0400
  17. #else
  18. #if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
  19. #error _WIN32_IE setting conflicts with _WIN32_WINNT setting
  20. #endif
  21. #endif
  22.  
  23. //
  24. // Define API decoration for direct importing of DLL references.
  25. //
  26. #ifndef WINCOMMCTRLAPI
  27. #if !defined(_COMCTL32_) && defined(_WIN32)
  28. #define WINCOMMCTRLAPI DECLSPEC_IMPORT
  29. #else
  30. #define WINCOMMCTRLAPI
  31. #endif
  32. #endif // WINCOMMCTRLAPI
  33.  
  34. #ifndef CCSIZEOF_STRUCT
  35. #define CCSIZEOF_STRUCT(structname, member)  (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
  36. #endif
  37.  
  38. //
  39. // For compilers that don't support nameless unions
  40. //
  41. #ifndef DUMMYUNIONNAME
  42. #ifdef NONAMELESSUNION
  43. #define DUMMYUNIONNAME   u
  44. #define DUMMYUNIONNAME2  u2
  45. #define DUMMYUNIONNAME3  u3
  46. #define DUMMYUNIONNAME4  u4
  47. #define DUMMYUNIONNAME5  u5
  48. #else
  49. #define DUMMYUNIONNAME
  50. #define DUMMYUNIONNAME2
  51. #define DUMMYUNIONNAME3
  52. #define DUMMYUNIONNAME4
  53. #define DUMMYUNIONNAME5
  54. #endif
  55. #endif // DUMMYUNIONNAME
  56.  
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60.  
  61.  
  62. #ifndef SNDMSG
  63. #ifdef __cplusplus
  64. #ifndef _MAC
  65. #define SNDMSG ::SendMessage
  66. #else
  67. #define SNDMSG ::AfxSendMessage
  68. #endif
  69. #else
  70. #ifndef _MAC
  71. #define SNDMSG SendMessage
  72. #else
  73. #define SNDMSG AfxSendMessage
  74. #endif
  75. #endif
  76. #endif // ifndef SNDMSG
  77.  
  78. #define MAXPROPPAGES            100
  79.  
  80. struct _PSP;
  81. typedef struct _PSP FAR* HPROPSHEETPAGE;
  82.  
  83. #ifndef MIDL_PASS
  84. struct _PROPSHEETPAGEA;
  85. struct _PROPSHEETPAGEW;
  86. #endif
  87.  
  88. typedef UINT (CALLBACK FAR * LPFNPSPCALLBACKA)(HWND hwnd, UINT uMsg, struct _PROPSHEETPAGEA FAR *ppsp);
  89. typedef UINT (CALLBACK FAR * LPFNPSPCALLBACKW)(HWND hwnd, UINT uMsg, struct _PROPSHEETPAGEW FAR *ppsp);
  90.  
  91. #ifdef UNICODE
  92. #define LPFNPSPCALLBACK         LPFNPSPCALLBACKW
  93. #else
  94. #define LPFNPSPCALLBACK         LPFNPSPCALLBACKA
  95. #endif
  96.  
  97. #define PSP_DEFAULT                0x00000000
  98. #define PSP_DLGINDIRECT            0x00000001
  99. #define PSP_USEHICON               0x00000002
  100. #define PSP_USEICONID              0x00000004
  101. #define PSP_USETITLE               0x00000008
  102. #define PSP_RTLREADING             0x00000010
  103.  
  104. #define PSP_HASHELP                0x00000020
  105. #define PSP_USEREFPARENT           0x00000040
  106. #define PSP_USECALLBACK            0x00000080
  107. #define PSP_PREMATURE              0x00000400
  108.  
  109. #if (_WIN32_IE >= 0x0400)
  110. //----- New flags for wizard97 --------------
  111. #define PSP_HIDEHEADER             0x00000800
  112. #define PSP_USEHEADERTITLE         0x00001000
  113. #define PSP_USEHEADERSUBTITLE      0x00002000
  114. //-------------------------------------------
  115. #endif
  116.  
  117.  
  118. #define PSPCB_RELEASE           1
  119. #define PSPCB_CREATE            2
  120.  
  121. #define PROPSHEETPAGEA_V1_SIZE CCSIZEOF_STRUCT(PROPSHEETPAGEA, pcRefParent)
  122. #define PROPSHEETPAGEW_V1_SIZE CCSIZEOF_STRUCT(PROPSHEETPAGEW, pcRefParent)
  123.  
  124. typedef struct _PROPSHEETPAGEA {
  125.         DWORD           dwSize;
  126.         DWORD           dwFlags;
  127.         HINSTANCE       hInstance;
  128.         union {
  129.             LPCSTR          pszTemplate;
  130. #ifdef _WIN32
  131.             LPCDLGTEMPLATE  pResource;
  132. #else
  133.             const VOID FAR *pResource;
  134. #endif
  135.         } DUMMYUNIONNAME;
  136.         union {
  137.             HICON       hIcon;
  138.             LPCSTR      pszIcon;
  139.         } DUMMYUNIONNAME2;
  140.         LPCSTR          pszTitle;
  141.         DLGPROC         pfnDlgProc;
  142.         LPARAM          lParam;
  143.         LPFNPSPCALLBACKA pfnCallback;
  144.         UINT FAR * pcRefParent;
  145.  
  146. #if (_WIN32_IE >= 0x0400)
  147.         LPCSTR pszHeaderTitle;    // this is displayed in the header
  148.         LPCSTR pszHeaderSubTitle; //
  149. #endif
  150. } PROPSHEETPAGEA, FAR *LPPROPSHEETPAGEA;
  151. typedef const PROPSHEETPAGEA FAR *LPCPROPSHEETPAGEA;
  152.  
  153. typedef struct _PROPSHEETPAGEW {
  154.         DWORD           dwSize;
  155.         DWORD           dwFlags;
  156.         HINSTANCE       hInstance;
  157.         union {
  158.             LPCWSTR          pszTemplate;
  159. #ifdef _WIN32
  160.             LPCDLGTEMPLATE  pResource;
  161. #else
  162.             const VOID FAR *pResource;
  163. #endif
  164.         }DUMMYUNIONNAME;
  165.         union {
  166.             HICON       hIcon;
  167.             LPCWSTR      pszIcon;
  168.         }DUMMYUNIONNAME2;
  169.         LPCWSTR          pszTitle;
  170.         DLGPROC         pfnDlgProc;
  171.         LPARAM          lParam;
  172.         LPFNPSPCALLBACKW pfnCallback;
  173.         UINT FAR * pcRefParent;
  174.         
  175. #if (_WIN32_IE >= 0x0400)
  176.         LPCWSTR pszHeaderTitle;    // this is displayed in the header
  177.         LPCWSTR pszHeaderSubTitle; ///
  178. #endif
  179. } PROPSHEETPAGEW, FAR *LPPROPSHEETPAGEW;
  180. typedef const PROPSHEETPAGEW FAR *LPCPROPSHEETPAGEW;
  181.  
  182. #ifdef UNICODE
  183. #define PROPSHEETPAGE           PROPSHEETPAGEW
  184. #define LPPROPSHEETPAGE         LPPROPSHEETPAGEW
  185. #define LPCPROPSHEETPAGE        LPCPROPSHEETPAGEW
  186. #define PROPSHEETPAGE_V1_SIZE PROPSHEETPAGEW_V1_SIZE
  187. #else
  188. #define PROPSHEETPAGE           PROPSHEETPAGEA
  189. #define LPPROPSHEETPAGE         LPPROPSHEETPAGEA
  190. #define LPCPROPSHEETPAGE        LPCPROPSHEETPAGEA
  191. #define PROPSHEETPAGE_V1_SIZE PROPSHEETPAGEA_V1_SIZE
  192. #endif
  193.  
  194.  
  195. #define PSH_DEFAULT             0x00000000
  196. #define PSH_PROPTITLE           0x00000001
  197. #define PSH_USEHICON            0x00000002
  198. #define PSH_USEICONID           0x00000004
  199. #define PSH_PROPSHEETPAGE       0x00000008
  200. #define PSH_WIZARDHASFINISH     0x00000010
  201. #define PSH_WIZARD              0x00000020
  202. #define PSH_USEPSTARTPAGE       0x00000040
  203. #define PSH_NOAPPLYNOW          0x00000080
  204. #define PSH_USECALLBACK         0x00000100
  205. #define PSH_HASHELP             0x00000200
  206. #define PSH_MODELESS            0x00000400
  207. #define PSH_RTLREADING          0x00000800
  208. #define PSH_WIZARDCONTEXTHELP   0x00001000
  209.  
  210. #if (_WIN32_IE >= 0x0400)
  211. //----- New flags for wizard97 -----------
  212. #define PSH_WIZARD97            0x00002000  
  213. // 0x00004000 was not used by any previous release
  214. #define PSH_WATERMARK           0x00008000
  215. #define PSH_USEHBMWATERMARK     0x00010000  // user pass in a hbmWatermark instead of pszbmWatermark
  216. #define PSH_USEHPLWATERMARK     0x00020000  //
  217. #define PSH_STRETCHWATERMARK    0x00040000  // stretchwatermark also applies for the header
  218. #define PSH_HEADER              0x00080000
  219. #define PSH_USEHBMHEADER        0x00100000
  220. #define PSH_USEPAGELANG         0x00200000  // use frame dialog template matched to page
  221. //----------------------------------------
  222. #endif
  223.  
  224.  
  225. typedef int (CALLBACK *PFNPROPSHEETCALLBACK)(HWND, UINT, LPARAM);
  226.  
  227. #define PROPSHEETHEADERA_V1_SIZE CCSIZEOF_STRUCT(PROPSHEETHEADERA, pfnCallback)
  228. #define PROPSHEETHEADERW_V1_SIZE CCSIZEOF_STRUCT(PROPSHEETHEADERW, pfnCallback)
  229.  
  230. typedef struct _PROPSHEETHEADERA {
  231.         DWORD           dwSize;
  232.         DWORD           dwFlags;
  233.         HWND            hwndParent;
  234.         HINSTANCE       hInstance;
  235.         union {
  236.             HICON       hIcon;
  237.             LPCSTR      pszIcon;
  238.         }DUMMYUNIONNAME;
  239.         LPCSTR          pszCaption;
  240.  
  241.         UINT            nPages;
  242.         union {
  243.             UINT        nStartPage;
  244.             LPCSTR      pStartPage;
  245.         }DUMMYUNIONNAME2;
  246.         union {
  247.             LPCPROPSHEETPAGEA ppsp;
  248.             HPROPSHEETPAGE FAR *phpage;
  249.         }DUMMYUNIONNAME3;
  250.         PFNPROPSHEETCALLBACK pfnCallback;
  251.  
  252. #if (_WIN32_IE >= 0x0400)
  253.         union {
  254.             HBITMAP hbmWatermark;
  255.             LPCSTR pszbmWatermark;
  256.         } DUMMYUNIONNAME4;
  257.         HPALETTE hplWatermark;
  258.         union {
  259.             HBITMAP hbmHeader;     // Header  bitmap shares the palette with watermark
  260.             LPCSTR pszbmHeader;
  261.         } DUMMYUNIONNAME5;
  262. #endif
  263. } PROPSHEETHEADERA, FAR *LPPROPSHEETHEADERA;
  264.  
  265. typedef const PROPSHEETHEADERA FAR *LPCPROPSHEETHEADERA;
  266.  
  267. typedef struct _PROPSHEETHEADERW {
  268.         DWORD           dwSize;
  269.         DWORD           dwFlags;
  270.         HWND            hwndParent;
  271.         HINSTANCE       hInstance;
  272.         union {
  273.             HICON       hIcon;
  274.             LPCWSTR     pszIcon;
  275.         }DUMMYUNIONNAME;
  276.         LPCWSTR         pszCaption;
  277.  
  278.  
  279.         UINT            nPages;
  280.         union {
  281.             UINT        nStartPage;
  282.             LPCWSTR     pStartPage;
  283.         }DUMMYUNIONNAME2;
  284.         union {
  285.             LPCPROPSHEETPAGEW ppsp;
  286.             HPROPSHEETPAGE FAR *phpage;
  287.         }DUMMYUNIONNAME3;
  288.         PFNPROPSHEETCALLBACK pfnCallback;
  289.  
  290. #if (_WIN32_IE >= 0x0400)
  291.         union {
  292.             HBITMAP hbmWatermark;
  293.             LPCWSTR pszbmWatermark;
  294.         } DUMMYUNIONNAME4;
  295.         HPALETTE hplWatermark;
  296.         union {
  297.             HBITMAP hbmHeader;
  298.             LPCWSTR pszbmHeader;
  299.         } DUMMYUNIONNAME5;
  300. #endif
  301. } PROPSHEETHEADERW, FAR *LPPROPSHEETHEADERW;
  302. typedef const PROPSHEETHEADERW FAR *LPCPROPSHEETHEADERW;
  303.  
  304. #ifdef UNICODE
  305. #define PROPSHEETHEADER         PROPSHEETHEADERW
  306. #define LPPROPSHEETHEADER       LPPROPSHEETHEADERW
  307. #define LPCPROPSHEETHEADER      LPCPROPSHEETHEADERW
  308. #define PROPSHEETHEADER_V1_SIZE PROPSHEETHEADERW_V1_SIZE
  309. #else
  310. #define PROPSHEETHEADER         PROPSHEETHEADERA
  311. #define LPPROPSHEETHEADER       LPPROPSHEETHEADERA
  312. #define LPCPROPSHEETHEADER      LPCPROPSHEETHEADERA
  313. #define PROPSHEETHEADER_V1_SIZE PROPSHEETHEADERA_V1_SIZE
  314. #endif
  315.  
  316.  
  317. #define PSCB_INITIALIZED  1
  318. #define PSCB_PRECREATE    2
  319.  
  320. WINCOMMCTRLAPI HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(LPCPROPSHEETPAGEA);
  321. WINCOMMCTRLAPI HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW);
  322. WINCOMMCTRLAPI BOOL           WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE);
  323. WINCOMMCTRLAPI int            WINAPI PropertySheetA(LPCPROPSHEETHEADERA);
  324. WINCOMMCTRLAPI int            WINAPI PropertySheetW(LPCPROPSHEETHEADERW);
  325.  
  326. #ifdef UNICODE
  327. #define CreatePropertySheetPage  CreatePropertySheetPageW
  328. #define PropertySheet            PropertySheetW
  329. #else
  330. #define CreatePropertySheetPage  CreatePropertySheetPageA
  331. #define PropertySheet            PropertySheetA
  332. #endif
  333.  
  334.  
  335.  
  336. typedef BOOL (CALLBACK FAR * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM);
  337. typedef BOOL (CALLBACK FAR * LPFNADDPROPSHEETPAGES)(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM);
  338.  
  339.  
  340. typedef struct _PSHNOTIFY
  341. {
  342.     NMHDR hdr;
  343.     LPARAM lParam;
  344. } PSHNOTIFY, FAR *LPPSHNOTIFY;
  345.  
  346. #define PSN_FIRST               (0U-200U)
  347. #define PSN_LAST                (0U-299U)
  348.  
  349.  
  350. #define PSN_SETACTIVE           (PSN_FIRST-0)
  351. #define PSN_KILLACTIVE          (PSN_FIRST-1)
  352. // #define PSN_VALIDATE            (PSN_FIRST-1)
  353. #define PSN_APPLY               (PSN_FIRST-2)
  354. #define PSN_RESET               (PSN_FIRST-3)
  355. // #define PSN_CANCEL              (PSN_FIRST-3)
  356. #define PSN_HELP                (PSN_FIRST-5)
  357. #define PSN_WIZBACK             (PSN_FIRST-6)
  358. #define PSN_WIZNEXT             (PSN_FIRST-7)
  359. #define PSN_WIZFINISH           (PSN_FIRST-8)
  360. #define PSN_QUERYCANCEL         (PSN_FIRST-9)
  361. #if (_WIN32_IE >= 0x0400)
  362. #define PSN_GETOBJECT           (PSN_FIRST-10)
  363. #endif // 0x0400
  364.  
  365. #define PSNRET_NOERROR              0
  366. #define PSNRET_INVALID              1
  367. #define PSNRET_INVALID_NOCHANGEPAGE 2
  368.  
  369.  
  370. #define PSM_SETCURSEL           (WM_USER + 101)
  371. #define PropSheet_SetCurSel(hDlg, hpage, index) \
  372.         SNDMSG(hDlg, PSM_SETCURSEL, (WPARAM)index, (LPARAM)hpage)
  373.  
  374.  
  375. #define PSM_REMOVEPAGE          (WM_USER + 102)
  376. #define PropSheet_RemovePage(hDlg, index, hpage) \
  377.         SNDMSG(hDlg, PSM_REMOVEPAGE, index, (LPARAM)hpage)
  378.  
  379.  
  380. #define PSM_ADDPAGE             (WM_USER + 103)
  381. #define PropSheet_AddPage(hDlg, hpage) \
  382.         SNDMSG(hDlg, PSM_ADDPAGE, 0, (LPARAM)hpage)
  383.  
  384.  
  385. #define PSM_CHANGED             (WM_USER + 104)
  386. #define PropSheet_Changed(hDlg, hwnd) \
  387.         SNDMSG(hDlg, PSM_CHANGED, (WPARAM)hwnd, 0L)
  388.  
  389.  
  390. #define PSM_RESTARTWINDOWS      (WM_USER + 105)
  391. #define PropSheet_RestartWindows(hDlg) \
  392.         SNDMSG(hDlg, PSM_RESTARTWINDOWS, 0, 0L)
  393.  
  394.  
  395. #define PSM_REBOOTSYSTEM        (WM_USER + 106)
  396. #define PropSheet_RebootSystem(hDlg) \
  397.         SNDMSG(hDlg, PSM_REBOOTSYSTEM, 0, 0L)
  398.  
  399.  
  400. #define PSM_CANCELTOCLOSE       (WM_USER + 107)
  401. #define PropSheet_CancelToClose(hDlg) \
  402.         PostMessage(hDlg, PSM_CANCELTOCLOSE, 0, 0L)
  403.  
  404.  
  405. #define PSM_QUERYSIBLINGS       (WM_USER + 108)
  406. #define PropSheet_QuerySiblings(hDlg, wParam, lParam) \
  407.         SNDMSG(hDlg, PSM_QUERYSIBLINGS, wParam, lParam)
  408.  
  409.  
  410. #define PSM_UNCHANGED           (WM_USER + 109)
  411. #define PropSheet_UnChanged(hDlg, hwnd) \
  412.         SNDMSG(hDlg, PSM_UNCHANGED, (WPARAM)hwnd, 0L)
  413.  
  414.  
  415. #define PSM_APPLY               (WM_USER + 110)
  416. #define PropSheet_Apply(hDlg) \
  417.         SNDMSG(hDlg, PSM_APPLY, 0, 0L)
  418.  
  419.  
  420. #define PSM_SETTITLEA           (WM_USER + 111)
  421. #define PSM_SETTITLEW           (WM_USER + 120)
  422.  
  423. #ifdef UNICODE
  424. #define PSM_SETTITLE            PSM_SETTITLEW
  425. #else
  426. #define PSM_SETTITLE            PSM_SETTITLEA
  427. #endif
  428.  
  429. #define PropSheet_SetTitle(hDlg, wStyle, lpszText)\
  430.         SNDMSG(hDlg, PSM_SETTITLE, wStyle, (LPARAM)(LPCTSTR)lpszText)
  431.  
  432.  
  433. #define PSM_SETWIZBUTTONS       (WM_USER + 112)
  434. #define PropSheet_SetWizButtons(hDlg, dwFlags) \
  435.         PostMessage(hDlg, PSM_SETWIZBUTTONS, 0, (LPARAM)dwFlags)
  436.  
  437.  
  438. #define PSWIZB_BACK             0x00000001
  439. #define PSWIZB_NEXT             0x00000002
  440. #define PSWIZB_FINISH           0x00000004
  441. #define PSWIZB_DISABLEDFINISH   0x00000008
  442.  
  443.  
  444. #define PSM_PRESSBUTTON         (WM_USER + 113)
  445. #define PropSheet_PressButton(hDlg, iButton) \
  446.         PostMessage(hDlg, PSM_PRESSBUTTON, (WPARAM)iButton, 0)
  447.  
  448.  
  449. #define PSBTN_BACK              0
  450. #define PSBTN_NEXT              1
  451. #define PSBTN_FINISH            2
  452. #define PSBTN_OK                3
  453. #define PSBTN_APPLYNOW          4
  454. #define PSBTN_CANCEL            5
  455. #define PSBTN_HELP              6
  456. #define PSBTN_MAX               6
  457.  
  458.  
  459.  
  460. #define PSM_SETCURSELID         (WM_USER + 114)
  461. #define PropSheet_SetCurSelByID(hDlg, id) \
  462.         SNDMSG(hDlg, PSM_SETCURSELID, 0, (LPARAM)id)
  463.  
  464.  
  465. #define PSM_SETFINISHTEXTA      (WM_USER + 115)
  466. #define PSM_SETFINISHTEXTW      (WM_USER + 121)
  467.  
  468. #ifdef UNICODE
  469. #define PSM_SETFINISHTEXT       PSM_SETFINISHTEXTW
  470. #else
  471. #define PSM_SETFINISHTEXT       PSM_SETFINISHTEXTA
  472. #endif
  473.  
  474. #define PropSheet_SetFinishText(hDlg, lpszText) \
  475.         SNDMSG(hDlg, PSM_SETFINISHTEXT, 0, (LPARAM)lpszText)
  476.  
  477.  
  478. #define PSM_GETTABCONTROL       (WM_USER + 116)
  479. #define PropSheet_GetTabControl(hDlg) \
  480.         (HWND)SNDMSG(hDlg, PSM_GETTABCONTROL, 0, 0)
  481.  
  482. #define PSM_ISDIALOGMESSAGE     (WM_USER + 117)
  483. #define PropSheet_IsDialogMessage(hDlg, pMsg) \
  484.         (BOOL)SNDMSG(hDlg, PSM_ISDIALOGMESSAGE, 0, (LPARAM)pMsg)
  485.  
  486. #define PSM_GETCURRENTPAGEHWND  (WM_USER + 118)
  487. #define PropSheet_GetCurrentPageHwnd(hDlg) \
  488.         (HWND)SNDMSG(hDlg, PSM_GETCURRENTPAGEHWND, 0, 0L)
  489.  
  490. #define ID_PSRESTARTWINDOWS     0x2
  491. #define ID_PSREBOOTSYSTEM       (ID_PSRESTARTWINDOWS | 0x1)
  492.  
  493.  
  494. #define WIZ_CXDLG               276
  495. #define WIZ_CYDLG               140
  496.  
  497. #define WIZ_CXBMP               80
  498.  
  499. #define WIZ_BODYX               92
  500. #define WIZ_BODYCX              184
  501.  
  502. #define PROP_SM_CXDLG           212
  503. #define PROP_SM_CYDLG           188
  504.  
  505. #define PROP_MED_CXDLG          227
  506. #define PROP_MED_CYDLG          215
  507.  
  508. #define PROP_LG_CXDLG           252
  509. #define PROP_LG_CYDLG           218
  510.  
  511.  
  512.  
  513. #ifdef __cplusplus
  514. }
  515. #endif
  516.  
  517.  
  518. #endif  // _PRSHT_H_
  519.  
  520.