1 /***********************************************************************\ 2 * prsht.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW Windows headers * 7 * by Vladimir Vlasov * 8 * * 9 * Placed into public domain * 10 \***********************************************************************/ 11 module win32.prsht; 12 pragma(lib, "comctl32.lib"); 13 14 private import win32.w32api, win32.windef, win32.winuser; 15 16 const MAXPROPPAGES = 100; 17 18 enum { 19 PSP_DEFAULT = 0x00000000, 20 PSP_DLGINDIRECT = 0x00000001, 21 PSP_USEHICON = 0x00000002, 22 PSP_USEICONID = 0x00000004, 23 PSP_USETITLE = 0x00000008, 24 PSP_RTLREADING = 0x00000010, 25 PSP_HASHELP = 0x00000020, 26 PSP_USEREFPARENT = 0x00000040, 27 PSP_USECALLBACK = 0x00000080, 28 PSP_PREMATURE = 0x00000400 29 } 30 31 static if (_WIN32_IE >= 0x0400) { 32 enum { 33 PSP_HIDEHEADER = 0x00000800, 34 PSP_USEHEADERTITLE = 0x00001000, 35 PSP_USEHEADERSUBTITLE = 0x00002000 36 } 37 } 38 39 enum { 40 PSPCB_RELEASE = 1, 41 PSPCB_CREATE 42 } 43 44 enum { 45 PSH_DEFAULT = 0x00000000, 46 PSH_PROPTITLE = 0x00000001, 47 PSH_USEHICON = 0x00000002, 48 PSH_USEICONID = 0x00000004, 49 PSH_PROPSHEETPAGE = 0x00000008, 50 PSH_WIZARDHASFINISH = 0x00000010, 51 PSH_WIZARD = 0x00000020, 52 PSH_USEPSTARTPAGE = 0x00000040, 53 PSH_NOAPPLYNOW = 0x00000080, 54 PSH_USECALLBACK = 0x00000100, 55 PSH_HASHELP = 0x00000200, 56 PSH_MODELESS = 0x00000400, 57 PSH_RTLREADING = 0x00000800, 58 PSH_WIZARDCONTEXTHELP = 0x00001000 59 } 60 61 static if (_WIN32_IE >= 0x0400) { 62 enum { 63 PSH_WATERMARK = 0x00008000, 64 PSH_USEHBMWATERMARK = 0x00010000, 65 PSH_USEHPLWATERMARK = 0x00020000, 66 PSH_STRETCHWATERMARK = 0x00040000, 67 PSH_HEADER = 0x00080000, 68 PSH_USEHBMHEADER = 0x00100000, 69 PSH_USEPAGELANG = 0x00200000 70 } 71 static if (_WIN32_IE < 0x0500) { 72 enum { 73 PSH_WIZARD97 = 0x00002000 74 } 75 } else { 76 enum { 77 PSH_WIZARD97 = 0x01000000 78 } 79 } 80 } 81 82 static if (_WIN32_IE >= 0x0500) { 83 enum { 84 PSH_WIZARD_LITE = 0x00400000, 85 PSH_NOCONTEXTHELP = 0x02000000 86 } 87 } 88 89 enum { 90 PSCB_INITIALIZED = 1, 91 PSCB_PRECREATE 92 } 93 94 enum { 95 PSN_FIRST = (-200), 96 PSN_LAST = (-299), 97 PSN_SETACTIVE = (-200), 98 PSN_KILLACTIVE = (-201), 99 PSN_APPLY = (-202), 100 PSN_RESET = (-203), 101 PSN_HELP = (-205), 102 PSN_WIZBACK = (-206), 103 PSN_WIZNEXT = (-207), 104 PSN_WIZFINISH = (-208), 105 PSN_QUERYCANCEL = (-209) 106 } 107 static if (_WIN32_IE >= 0x0400) { 108 enum { 109 PSN_GETOBJECT = (-210) 110 } 111 } 112 static if (_WIN32_IE >= 0x0500) { 113 enum { 114 PSN_TRANSLATEACCELERATOR = (-212), 115 PSN_QUERYINITIALFOCUS = (-213) 116 } 117 } 118 119 enum { 120 PSNRET_NOERROR, 121 PSNRET_INVALID, 122 PSNRET_INVALID_NOCHANGEPAGE, 123 PSNRET_MESSAGEHANDLED 124 } 125 126 enum { 127 ID_PSRESTARTWINDOWS = 0x2, 128 ID_PSREBOOTSYSTEM = ID_PSRESTARTWINDOWS | 0x1 129 } 130 131 enum { 132 WIZ_CXDLG = 276, 133 WIZ_CYDLG = 140, 134 WIZ_CXBMP = 80, 135 WIZ_BODYX = 92, 136 WIZ_BODYCX = 184 137 } 138 139 enum { 140 PROP_SM_CXDLG = 212, 141 PROP_SM_CYDLG = 188, 142 PROP_MED_CXDLG = 227, 143 PROP_MED_CYDLG = 215, 144 PROP_LG_CXDLG = 252, 145 PROP_LG_CYDLG = 218 146 } 147 148 enum { 149 PSBTN_BACK, 150 PSBTN_NEXT, 151 PSBTN_FINISH, 152 PSBTN_OK, 153 PSBTN_APPLYNOW, 154 PSBTN_CANCEL, 155 PSBTN_HELP, 156 PSBTN_MAX = 6 157 } 158 159 enum { 160 PSWIZB_BACK = 1, 161 PSWIZB_NEXT = 2, 162 PSWIZB_FINISH = 4, 163 PSWIZB_DISABLEDFINISH = 8 164 } 165 166 enum { 167 PSM_SETCURSEL = WM_USER + 101, 168 PSM_REMOVEPAGE, 169 PSM_ADDPAGE, 170 PSM_CHANGED, 171 PSM_RESTARTWINDOWS, 172 PSM_REBOOTSYSTEM, 173 PSM_CANCELTOCLOSE, 174 PSM_QUERYSIBLINGS, 175 PSM_UNCHANGED, 176 PSM_APPLY, 177 PSM_SETTITLEA, 178 PSM_SETWIZBUTTONS, 179 PSM_PRESSBUTTON, 180 PSM_SETCURSELID, 181 PSM_SETFINISHTEXTA, 182 PSM_GETTABCONTROL, 183 PSM_ISDIALOGMESSAGE, 184 PSM_GETCURRENTPAGEHWND, 185 PSM_INSERTPAGE, 186 PSM_SETTITLEW, 187 PSM_SETFINISHTEXTW // = WM_USER + 121, 188 } 189 190 alias UINT function(HWND, UINT, LPPROPSHEETPAGEA) LPFNPSPCALLBACKA; 191 alias UINT function(HWND, UINT, LPPROPSHEETPAGEW) LPFNPSPCALLBACKW; 192 alias int function(HWND, UINT, LPARAM) PFNPROPSHEETCALLBACK; 193 194 align(4): 195 196 struct PROPSHEETPAGEA { 197 DWORD dwSize = PROPSHEETPAGEA.sizeof; 198 DWORD dwFlags; 199 HINSTANCE hInstance; 200 union { 201 LPCSTR pszTemplate; 202 LPCDLGTEMPLATE pResource; 203 } 204 union { 205 HICON hIcon; 206 LPCSTR pszIcon; 207 } 208 LPCSTR pszTitle; 209 DLGPROC pfnDlgProc; 210 LPARAM lParam; 211 LPFNPSPCALLBACKA pfnCallback; 212 UINT* pcRefParent; 213 static if (_WIN32_IE >= 0x0400) { 214 LPCSTR pszHeaderTitle; 215 LPCSTR pszHeaderSubTitle; 216 } 217 } 218 alias PROPSHEETPAGEA* LPPROPSHEETPAGEA; 219 alias CPtr!(PROPSHEETPAGEA) LPCPROPSHEETPAGEA; 220 221 struct PROPSHEETPAGEW { 222 DWORD dwSize = PROPSHEETPAGEW.sizeof; 223 DWORD dwFlags; 224 HINSTANCE hInstance; 225 union { 226 LPCWSTR pszTemplate; 227 LPCDLGTEMPLATE pResource; 228 } 229 union { 230 HICON hIcon; 231 LPCWSTR pszIcon; 232 } 233 LPCWSTR pszTitle; 234 DLGPROC pfnDlgProc; 235 LPARAM lParam; 236 LPFNPSPCALLBACKW pfnCallback; 237 UINT* pcRefParent; 238 static if (_WIN32_IE >= 0x0400) { 239 LPCWSTR pszHeaderTitle; 240 LPCWSTR pszHeaderSubTitle; 241 } 242 } 243 alias PROPSHEETPAGEW* LPPROPSHEETPAGEW; 244 alias CPtr!(PROPSHEETPAGEW) LPCPROPSHEETPAGEW; 245 246 alias HANDLE HPROPSHEETPAGE; 247 248 struct PROPSHEETHEADERA { 249 DWORD dwSize = PROPSHEETHEADERA.sizeof; 250 DWORD dwFlags; 251 HWND hwndParent; 252 HINSTANCE hInstance; 253 union { 254 HICON hIcon; 255 LPCSTR pszIcon; 256 } 257 LPCSTR pszCaption; 258 UINT nPages; 259 union { 260 UINT nStartPage; 261 LPCSTR pStartPage; 262 } 263 union { 264 LPCPROPSHEETPAGEA ppsp; 265 HPROPSHEETPAGE* phpage; 266 } 267 PFNPROPSHEETCALLBACK pfnCallback; 268 static if (_WIN32_IE >= 0x0400) { 269 union { 270 HBITMAP hbmWatermark; 271 LPCSTR pszbmWatermark; 272 } 273 HPALETTE hplWatermark; 274 union { 275 HBITMAP hbmHeader; 276 LPCSTR pszbmHeader; 277 } 278 } 279 } 280 alias PROPSHEETHEADERA* LPPROPSHEETHEADERA; 281 alias CPtr!(PROPSHEETHEADERA) LPCPROPSHEETHEADERA; 282 283 struct PROPSHEETHEADERW { 284 DWORD dwSize = PROPSHEETHEADERW.sizeof; 285 DWORD dwFlags; 286 HWND hwndParent; 287 HINSTANCE hInstance; 288 union { 289 HICON hIcon; 290 LPCWSTR pszIcon; 291 } 292 LPCWSTR pszCaption; 293 UINT nPages; 294 union { 295 UINT nStartPage; 296 LPCWSTR pStartPage; 297 } 298 union { 299 LPCPROPSHEETPAGEW ppsp; 300 HPROPSHEETPAGE* phpage; 301 } 302 PFNPROPSHEETCALLBACK pfnCallback; 303 static if (_WIN32_IE >= 0x0400) { 304 union { 305 HBITMAP hbmWatermark; 306 LPCWSTR pszbmWatermark; 307 } 308 HPALETTE hplWatermark; 309 union { 310 HBITMAP hbmHeader; 311 LPCWSTR pszbmHeader; 312 } 313 } 314 } 315 alias PROPSHEETHEADERW* LPPROPSHEETHEADERW; 316 alias CPtr!(PROPSHEETHEADERW) LPCPROPSHEETHEADERW; 317 318 alias BOOL function(HPROPSHEETPAGE, LPARAM) LPFNADDPROPSHEETPAGE; 319 alias BOOL function(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM) 320 LPFNADDPROPSHEETPAGES; 321 322 struct PSHNOTIFY { 323 NMHDR hdr; 324 LPARAM lParam; 325 } 326 alias PSHNOTIFY* LPPSHNOTIFY; 327 328 extern (Windows) { 329 HPROPSHEETPAGE CreatePropertySheetPageA(LPCPROPSHEETPAGEA); 330 HPROPSHEETPAGE CreatePropertySheetPageW(LPCPROPSHEETPAGEW); 331 BOOL DestroyPropertySheetPage(HPROPSHEETPAGE); 332 int PropertySheetA(LPCPROPSHEETHEADERA); 333 int PropertySheetW(LPCPROPSHEETHEADERW); 334 } 335 336 version (Unicode) { 337 alias LPFNPSPCALLBACKW LPFNPSPCALLBACK; 338 alias PROPSHEETPAGEW PROPSHEETPAGE; 339 alias LPPROPSHEETPAGEW LPPROPSHEETPAGE; 340 alias LPCPROPSHEETPAGEW LPCPROPSHEETPAGE; 341 alias PROPSHEETHEADERW PROPSHEETHEADER; 342 alias LPPROPSHEETHEADERW LPPROPSHEETHEADER; 343 alias LPCPROPSHEETHEADERW LPCPROPSHEETHEADER; 344 alias PSM_SETTITLEW PSM_SETTITLE; 345 alias PSM_SETFINISHTEXTW PSM_SETFINISHTEXT; 346 alias CreatePropertySheetPageW CreatePropertySheetPage; 347 alias PropertySheetW PropertySheet; 348 } else { 349 alias LPFNPSPCALLBACKA LPFNPSPCALLBACK; 350 alias PROPSHEETPAGEA PROPSHEETPAGE; 351 alias LPPROPSHEETPAGEA LPPROPSHEETPAGE; 352 alias LPCPROPSHEETPAGEA LPCPROPSHEETPAGE; 353 alias PROPSHEETHEADERA PROPSHEETHEADER; 354 alias LPPROPSHEETHEADERA LPPROPSHEETHEADER; 355 alias LPCPROPSHEETHEADERA LPCPROPSHEETHEADER; 356 alias PSM_SETTITLEA PSM_SETTITLE; 357 alias PSM_SETFINISHTEXTA PSM_SETFINISHTEXT; 358 alias CreatePropertySheetPageA CreatePropertySheetPage; 359 alias PropertySheetA PropertySheet; 360 } 361 362 BOOL PropSheet_SetCurSel(HWND hPropSheetDlg, HPROPSHEETPAGE hpage, 363 HPROPSHEETPAGE index) { 364 return cast(BOOL) SendMessage(hPropSheetDlg, PSM_SETCURSEL, 365 cast(WPARAM) index, cast(LPARAM) hpage); 366 } 367 368 VOID PropSheet_RemovePage(HWND hPropSheetDlg, int index, HPROPSHEETPAGE hpage) { 369 SendMessage(hPropSheetDlg, PSM_REMOVEPAGE, index, cast(LPARAM) hpage); 370 } 371 372 BOOL PropSheet_AddPage(HWND hPropSheetDlg, HPROPSHEETPAGE hpage) { 373 return cast(BOOL) SendMessage(hPropSheetDlg, PSM_ADDPAGE, 374 0, cast(LPARAM) hpage); 375 } 376 377 VOID PropSheet_Changed(HWND hPropSheetDlg, HWND hwndPage) { 378 SendMessage(hPropSheetDlg, PSM_CHANGED, cast(WPARAM) hwndPage, 0); 379 } 380 381 VOID PropSheet_RestartWindows(HWND hPropSheetDlg) { 382 SendMessage(hPropSheetDlg, PSM_RESTARTWINDOWS, 0, 0); 383 } 384 385 VOID PropSheet_RebootSystem(HWND hPropSheetDlg) { 386 SendMessage(hPropSheetDlg, PSM_REBOOTSYSTEM, 0, 0); 387 } 388 389 VOID PropSheet_CancelToClose(HWND hPropSheetDlg) { 390 SendMessage(hPropSheetDlg, PSM_CANCELTOCLOSE, 0, 0); 391 } 392 393 int PropSheet_QuerySiblings(HWND hPropSheetDlg, WPARAM param1, LPARAM param2) { 394 return SendMessage(hPropSheetDlg, PSM_QUERYSIBLINGS, param1, param2); 395 } 396 397 VOID PropSheet_UnChanged(HWND hPropSheetDlg, HWND hwndPage) { 398 SendMessage(hPropSheetDlg, PSM_UNCHANGED, cast(WPARAM) hwndPage, 0); 399 } 400 401 BOOL PropSheet_Apply(HWND hPropSheetDlg) { 402 return cast(BOOL) SendMessage(hPropSheetDlg, PSM_APPLY, 0, 0); 403 } 404 405 VOID PropSheet_SetTitle(HWND hPropSheetDlg, DWORD wStyle, LPTSTR lpszText) { 406 SendMessage(hPropSheetDlg, PSM_SETTITLE, wStyle, cast(LPARAM) lpszText); 407 } 408 409 VOID PropSheet_SetWizButtons(HWND hPropSheetDlg, DWORD dwFlags) { 410 PostMessage(hPropSheetDlg, PSM_SETWIZBUTTONS, 0, cast(LPARAM) dwFlags); 411 } 412 413 BOOL PropSheet_PressButton(HWND hPropSheetDlg, int iButton) { 414 return cast(BOOL) SendMessage(hPropSheetDlg, PSM_PRESSBUTTON, iButton, 0); 415 } 416 417 BOOL PropSheet_SetCurSelByID(HWND hPropSheetDlg, int id) { 418 return cast(BOOL) SendMessage(hPropSheetDlg, PSM_SETCURSELID, 0, id); 419 } 420 421 VOID PropSheet_SetFinishText(HWND hPropSheetDlg, LPTSTR lpszText) { 422 SendMessage(hPropSheetDlg, PSM_SETFINISHTEXT, 0, cast(LPARAM) lpszText); 423 } 424 425 HWND PropSheet_GetTabControl(HWND hPropSheetDlg) { 426 return cast(HWND) SendMessage(hPropSheetDlg, PSM_GETTABCONTROL, 0, 0); 427 } 428 429 BOOL PropSheet_IsDialogMessage(HWND hDlg, LPMSG pMsg) { 430 return cast(BOOL) SendMessage(hDlg, PSM_ISDIALOGMESSAGE, 431 0, cast(LPARAM) pMsg); 432 } 433 434 HWND PropSheet_GetCurrentPageHwnd(HWND hDlg) { 435 return cast(HWND) SendMessage(hDlg, PSM_GETCURRENTPAGEHWND, 0, 0); 436 } 437 438 BOOL PropSheet_InsertPage(HWND hPropSheetDlg, WPARAM wInsertAfter, 439 HPROPSHEETPAGE hpage) { 440 return cast(BOOL) SendMessage(hPropSheetDlg, PSM_INSERTPAGE, 441 wInsertAfter, cast(LPARAM) hpage); 442 }