Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

374 lines
14 KiB

  1. /****************************************************************************
  2. * *
  3. * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY *
  4. * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
  5. * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR *
  6. * PURPOSE. *
  7. * *
  8. * Copyright (C) 1993-95 Microsoft Corporation. All Rights Reserved. *
  9. * *
  10. ****************************************************************************/
  11. //----------------------------------------------------------------------------
  12. //
  13. // prsht.h - PropSheet definitions
  14. //
  15. //----------------------------------------------------------------------------
  16. #ifndef _PRSHT_H_
  17. #define _PRSHT_H_
  18. //
  19. // Define API decoration for direct importing of DLL references.
  20. //
  21. #ifndef WINCOMMCTRLAPI
  22. #if !defined(_COMCTL32_) && defined(_WIN32)
  23. #define WINCOMMCTRLAPI DECLSPEC_IMPORT
  24. #else
  25. #define WINCOMMCTRLAPI
  26. #endif
  27. #endif // WINCOMMCTRLAPI
  28. //
  29. // For compilers that don't support nameless unions
  30. //
  31. #ifndef DUMMYUNIONNAME
  32. #ifdef NONAMELESSUNION
  33. #define DUMMYUNIONNAME u
  34. #define DUMMYUNIONNAME2 u2
  35. #define DUMMYUNIONNAME3 u3
  36. #else
  37. #define DUMMYUNIONNAME
  38. #define DUMMYUNIONNAME2
  39. #define DUMMYUNIONNAME3
  40. #endif
  41. #endif // DUMMYUNIONNAME
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. #define MAXPROPPAGES 100
  46. struct _PSP;
  47. typedef struct _PSP FAR* HPROPSHEETPAGE;
  48. typedef struct _PROPSHEETPAGE FAR *LPPROPSHEETPAGE; // forward declaration
  49. //
  50. // Property sheet page helper function
  51. //
  52. typedef UINT (CALLBACK FAR * LPFNPSPCALLBACK)(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp);
  53. #define PSP_DEFAULT 0x0000
  54. #define PSP_DLGINDIRECT 0x0001 // use pResource instead of pszTemplate
  55. #define PSP_USEHICON 0x0002
  56. #define PSP_USEICONID 0x0004
  57. #define PSP_USETITLE 0x0008
  58. #define PSP_RTLREADING 0x0010 // MidEast versions only
  59. #define PSP_HASHELP 0x0020
  60. #define PSP_USEREFPARENT 0x0040
  61. #define PSP_USECALLBACK 0x0080
  62. #define PSPCB_RELEASE 1
  63. #define PSPCB_CREATE 2
  64. // this structure is passed to CreatePropertySheetPage() and is in the LPARAM on
  65. // of the WM_INITDIALOG message when a property sheet page is created
  66. typedef struct _PROPSHEETPAGE {
  67. DWORD dwSize; // size of this structure (including extra data)
  68. DWORD dwFlags; // PSP_ bits define the use and meaning of fields
  69. HINSTANCE hInstance; // instance to load the template from
  70. union {
  71. LPCSTR pszTemplate; // template to use
  72. #ifdef _WIN32
  73. LPCDLGTEMPLATE pResource; // PSP_DLGINDIRECT: pointer to resource in memory
  74. #else
  75. const VOID FAR *pResource; // PSP_DLGINDIRECT: pointer to resource in memory
  76. #endif
  77. } DUMMYUNIONNAME;
  78. union {
  79. HICON hIcon; // PSP_USEICON: hIcon to use
  80. LPCSTR pszIcon; // PSP_USEICONID: or icon name string or icon id
  81. } DUMMYUNIONNAME2;
  82. LPCSTR pszTitle; // name to override the template title or string id
  83. DLGPROC pfnDlgProc; // dlg proc
  84. LPARAM lParam; // user data
  85. LPFNPSPCALLBACK pfnCallback; // if PSP_USECALLBACK this is called with PSPCB_* msgs
  86. UINT FAR * pcRefParent; // PSP_USERREFPARENT: pointer to ref count variable
  87. } PROPSHEETPAGE;
  88. typedef const PROPSHEETPAGE FAR *LPCPROPSHEETPAGE;
  89. #define PSH_DEFAULT 0x0000
  90. #define PSH_PROPTITLE 0x0001 // use "Properties for <lpszCaption>" as the title
  91. #define PSH_USEHICON 0x0002 // use specified hIcon for the caption
  92. #define PSH_USEICONID 0x0004 // use lpszIcon to load the icon
  93. #define PSH_PROPSHEETPAGE 0x0008 // use ppsp instead of phpage (points to array of PROPSHEETPAGE structures)
  94. #define PSH_WIZARD 0x0020 // Wizard
  95. #define PSH_USEPSTARTPAGE 0x0040 // use pStartPage for starting page
  96. #define PSH_NOAPPLYNOW 0x0080 // Remove Apply Now button
  97. #define PSH_USECALLBACK 0x0100 // pfnCallback is valid
  98. #define PSH_HASHELP 0x0200 // Display help button
  99. #define PSH_MODELESS 0x0400 // modless property sheet, PropertySheet returns HWND
  100. #define PSH_RTLREADING 0x0800 // MidEast versions only
  101. typedef int (CALLBACK *PFNPROPSHEETCALLBACK)(HWND, UINT, LPARAM);
  102. typedef struct _PROPSHEETHEADER {
  103. DWORD dwSize; // size of this structure
  104. DWORD dwFlags; // PSH_
  105. HWND hwndParent;
  106. HINSTANCE hInstance; // to load icon, caption or page string
  107. union {
  108. HICON hIcon; // PSH_USEHICON: hIcon to use
  109. LPCSTR pszIcon; // PSH_USEICONID: or icon name string or icon id
  110. } DUMMYUNIONNAME;
  111. LPCSTR pszCaption; // PSH_PROPTITLE: dlg caption or "Properties for <lpszCaption>"
  112. // may be MAKEINTRESOURCE()
  113. UINT nPages; // # of HPROPSHEETPAGE (or PROPSHEETPAGE) elements in phpage
  114. union {
  115. UINT nStartPage; // !PSH_USEPSTARTPAGE: page number (0-based)
  116. LPCSTR pStartPage; // PSH_USEPSTARTPAGE: name of page or string id
  117. } DUMMYUNIONNAME2;
  118. union {
  119. LPCPROPSHEETPAGE ppsp;
  120. HPROPSHEETPAGE FAR *phpage;
  121. } DUMMYUNIONNAME3;
  122. PFNPROPSHEETCALLBACK pfnCallback;
  123. } PROPSHEETHEADER, FAR *LPPROPSHEETHEADER;
  124. typedef const PROPSHEETHEADER FAR *LPCPROPSHEETHEADER;
  125. //
  126. // pfnCallback message values
  127. //
  128. #define PSCB_INITIALIZED 1
  129. #define PSCB_PRECREATE 2
  130. //
  131. // property sheet APIs
  132. //
  133. WINCOMMCTRLAPI HPROPSHEETPAGE WINAPI CreatePropertySheetPage(LPCPROPSHEETPAGE);
  134. WINCOMMCTRLAPI BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE);
  135. WINCOMMCTRLAPI int WINAPI PropertySheet(LPCPROPSHEETHEADER);
  136. //
  137. // callback for property sheet extensions to call to add pages
  138. //
  139. typedef BOOL (CALLBACK FAR * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM);
  140. //
  141. // generic routine for prop sheet extensions to export. this is called
  142. // to have the extension add pages. specific versions of this will be
  143. // implemented when necessary.
  144. //
  145. typedef BOOL (CALLBACK FAR * LPFNADDPROPSHEETPAGES)(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM);
  146. typedef struct _PSHNOTIFY
  147. {
  148. NMHDR hdr;
  149. LPARAM lParam;
  150. } PSHNOTIFY, FAR *LPPSHNOTIFY;
  151. #define PSN_FIRST (0U-200U)
  152. #define PSN_LAST (0U-299U)
  153. // PropertySheet notification codes sent to the page. NOTE: RESULTS
  154. // MUST BE RETURNED BY USING SetWindowLong(hdlg, DWL_MSGRESULT, result)
  155. // page is being activated. initialize the data on the page here if other pages can
  156. // effect this page, otherwise init the page at WM_INITDIALOG time. return value is
  157. // ignored.
  158. #define PSN_SETACTIVE (PSN_FIRST-0)
  159. // indicates the current page is being switched away from. validate input
  160. // at this time and return TRUE to keep the page switch from happening.
  161. // to commit changes on page switches commit data after validating on this message.
  162. #define PSN_KILLACTIVE (PSN_FIRST-1)
  163. // #define PSN_VALIDATE (PSN_FIRST-1)
  164. // indicates that the OK or Apply Now buttons have been pressed (OK will
  165. // destroy the dialog when done)
  166. // pshnotify's lparam is true if this was from an IDOK, false if it's from applynow
  167. // return TRUE or PSNRET_INVALID to abort the save
  168. #define PSN_APPLY (PSN_FIRST-2)
  169. // indicates that the cancel button has been pressed, the page may want use this
  170. // as an oportunity to confirm canceling the dialog.
  171. // pshnotify's lparam is true if it was done by system close button, false if it's from idcancel button
  172. #define PSN_RESET (PSN_FIRST-3)
  173. // #define PSN_CANCEL (PSN_FIRST-3)
  174. // sent to page indicating that the help button has been pressed
  175. #define PSN_HELP (PSN_FIRST-5)
  176. // sent to wizard sheets only
  177. #define PSN_WIZBACK (PSN_FIRST-6)
  178. #define PSN_WIZNEXT (PSN_FIRST-7)
  179. #define PSN_WIZFINISH (PSN_FIRST-8)
  180. // called sheet can reject a cancel by returning non-zero
  181. #define PSN_QUERYCANCEL (PSN_FIRST-9)
  182. // results that may be returned:
  183. #define PSNRET_NOERROR 0
  184. #define PSNRET_INVALID 1
  185. #define PSNRET_INVALID_NOCHANGEPAGE 2
  186. //// MESSAGES sent to the main property sheet dialog
  187. // used to set the current selection
  188. // supply either the hpage or the index to the tab
  189. #define PSM_SETCURSEL (WM_USER + 101)
  190. #define PropSheet_SetCurSel(hDlg, hpage, index) \
  191. SendMessage(hDlg, PSM_SETCURSEL, (WPARAM)index, (LPARAM)hpage)
  192. // remove a page
  193. // wParam = index of page to remove
  194. // lParam = hwnd of page to remove
  195. #define PSM_REMOVEPAGE (WM_USER + 102)
  196. #define PropSheet_RemovePage(hDlg, index, hpage) \
  197. SendMessage(hDlg, PSM_REMOVEPAGE, index, (LPARAM)hpage)
  198. // add a page
  199. // lParam = hPage of page to remove
  200. #define PSM_ADDPAGE (WM_USER + 103)
  201. #define PropSheet_AddPage(hDlg, hpage) \
  202. SendMessage(hDlg, PSM_ADDPAGE, 0, (LPARAM)hpage)
  203. // tell the PS manager that that the page has changed and "Apply Now" should be enabled
  204. // (we may mark the visually tab so the user knows that a change has been made)
  205. #define PSM_CHANGED (WM_USER + 104)
  206. #define PropSheet_Changed(hDlg, hwnd) \
  207. SendMessage(hDlg, PSM_CHANGED, (WPARAM)hwnd, 0L)
  208. // tell the PS manager that we need to restart windows due to a change made so
  209. // the restart windows dialog will be presented when dismissing the dialog
  210. #define PSM_RESTARTWINDOWS (WM_USER + 105)
  211. #define PropSheet_RestartWindows(hDlg) \
  212. SendMessage(hDlg, PSM_RESTARTWINDOWS, 0, 0L)
  213. // tell the PS manager that we need to reboot due to a change made so
  214. // the reboot windows dialog will be presented when dismissing the dialog
  215. #define PSM_REBOOTSYSTEM (WM_USER + 106)
  216. #define PropSheet_RebootSystem(hDlg) \
  217. SendMessage(hDlg, PSM_REBOOTSYSTEM, 0, 0L)
  218. // change the OK button to Close and disable cancel. this indicates a non cancelable
  219. // change has been made
  220. #define PSM_CANCELTOCLOSE (WM_USER + 107)
  221. #define PropSheet_CancelToClose(hDlg) \
  222. SendMessage(hDlg, PSM_CANCELTOCLOSE, 0, 0L)
  223. // have the PS manager forward this query to each initialized tab's hwnd
  224. // until a non-zero value is returned. This value is returned to the caller.
  225. #define PSM_QUERYSIBLINGS (WM_USER + 108)
  226. #define PropSheet_QuerySiblings(hDlg, wParam, lParam) \
  227. SendMessage(hDlg, PSM_QUERYSIBLINGS, wParam, lParam)
  228. // tell the PS manager the opposite of PSM_CHANGED -- that the page has reverted
  229. // to its previously saved state. If no pages remain changed, "Apply Now"
  230. // will be disabled. (we may remove the visually marked tab so that the user
  231. // knows no change has been made)
  232. #define PSM_UNCHANGED (WM_USER + 109)
  233. #define PropSheet_UnChanged(hDlg, hwnd) \
  234. SendMessage(hDlg, PSM_UNCHANGED, (WPARAM)hwnd, 0L)
  235. // tell the PS manager to do an "Apply Now"
  236. #define PSM_APPLY (WM_USER + 110)
  237. #define PropSheet_Apply(hDlg) \
  238. SendMessage(hDlg, PSM_APPLY, 0, 0L)
  239. // iStyle can be PSH_PROPTITLE or PSH_DEFAULT
  240. // lpszText can be a string or an rcid
  241. #define PSM_SETTITLE (WM_USER + 111)
  242. #define PropSheet_SetTitle(hDlg, wStyle, lpszText)\
  243. SendMessage(hDlg, PSM_SETTITLE, wStyle, (LPARAM)(LPCSTR)lpszText)
  244. // tell the PS manager which wizard buttons to enable.
  245. #define PSM_SETWIZBUTTONS (WM_USER + 112)
  246. #define PropSheet_SetWizButtons(hDlg, dwFlags) \
  247. PostMessage(hDlg, PSM_SETWIZBUTTONS, 0, (LPARAM)dwFlags)
  248. #define PSWIZB_BACK 0x00000001
  249. #define PSWIZB_NEXT 0x00000002
  250. #define PSWIZB_FINISH 0x00000004
  251. #define PSWIZB_DISABLEDFINISH 0x00000008 // Show disabled finish button
  252. // press a button automagically
  253. #define PSM_PRESSBUTTON (WM_USER + 113)
  254. #define PropSheet_PressButton(hDlg, iButton) \
  255. SendMessage(hDlg, PSM_PRESSBUTTON, (WPARAM)iButton, 0)
  256. #define PSBTN_BACK 0
  257. #define PSBTN_NEXT 1
  258. #define PSBTN_FINISH 2
  259. #define PSBTN_OK 3
  260. #define PSBTN_APPLYNOW 4
  261. #define PSBTN_CANCEL 5
  262. #define PSBTN_HELP 6
  263. // used to set the current selection by supplying the resource ID
  264. // supply either the hpage or the index to the tab
  265. #define PSM_SETCURSELID (WM_USER + 114)
  266. #define PropSheet_SetCurSelByID(hDlg, id) \
  267. SendMessage(hDlg, PSM_SETCURSELID, 0, (LPARAM)id)
  268. //
  269. // Force the "Finish" button to be enabled and change
  270. // the text to the specified string. The Back button will be hidden.
  271. //
  272. #define PSM_SETFINISHTEXT (WM_USER + 115)
  273. #define PropSheet_SetFinishText(hDlg, lpszText) \
  274. SendMessage(hDlg, PSM_SETFINISHTEXT, 0, (LPARAM)lpszText)
  275. // returns the tab control
  276. #define PSM_GETTABCONTROL (WM_USER + 116)
  277. #define PropSheet_GetTabControl(hDlg) \
  278. (HWND)SendMessage(hDlg, PSM_GETTABCONTROL, 0, 0)
  279. #define PSM_ISDIALOGMESSAGE (WM_USER + 117)
  280. #define PropSheet_IsDialogMessage(hDlg, pMsg) \
  281. (BOOL)SendMessage(hDlg, PSM_ISDIALOGMESSAGE, 0, (LPARAM)pMsg)
  282. #define PSM_GETCURRENTPAGEHWND (WM_USER + 118)
  283. #define PropSheet_GetCurrentPageHwnd(hDlg) \
  284. (HWND)SendMessage(hDlg, PSM_GETCURRENTPAGEHWND, 0, 0L)
  285. #define ID_PSRESTARTWINDOWS 0x2
  286. #define ID_PSREBOOTSYSTEM (ID_PSRESTARTWINDOWS | 0x1)
  287. //
  288. // Standard sizes for wizard sheet dialog templates. Use these sizes to create
  289. // wizards that conform to the Windows standard.
  290. //
  291. #define WIZ_CXDLG 276
  292. #define WIZ_CYDLG 140
  293. #define WIZ_CXBMP 80 // Org at 0,0 -- Use WIZ_CYDLG for height
  294. #define WIZ_BODYX 92 // Y org is 0
  295. #define WIZ_BODYCX 184
  296. //
  297. // Standard sizes for property sheet dialog templates. Use these
  298. // property sheets that conform to the Windows standard.
  299. //
  300. #define PROP_SM_CXDLG 212 // small
  301. #define PROP_SM_CYDLG 188
  302. #define PROP_MED_CXDLG 227 // medium
  303. #define PROP_MED_CYDLG 215 // some are 200
  304. #define PROP_LG_CXDLG 252 // large
  305. #define PROP_LG_CYDLG 218
  306. #ifdef __cplusplus
  307. } /* end of 'extern "C" {' */
  308. #endif
  309. #endif // _PRSHT_H_