Windows NT 4.0 source code leak
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.

391 lines
14 KiB

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