1 // Licensed under the Apache License, Version 2.0 2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 4 // All files in the project carrying such notice may not be copied, modified, or distributed 5 // except according to those terms. 6 //! 32-Bit Common Dialog APIs 7 use ctypes::{c_short, c_void}; 8 use shared::basetsd::UINT_PTR; 9 use shared::minwindef::{ 10 BOOL, DWORD, HGLOBAL, HINSTANCE, INT, LPARAM, LPVOID, LRESULT, UINT, WORD, WPARAM, 11 }; 12 use shared::windef::{COLORREF, HDC, HWND, POINT, RECT}; 13 use um::prsht::HPROPSHEETPAGE; 14 use um::unknwnbase::{IUnknown, IUnknownVtbl, LPUNKNOWN}; 15 use um::wingdi::{DM_COLLATE, DM_COPIES, LPDEVMODEW, LPLOGFONTA, LPLOGFONTW}; 16 use um::winnt::{HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR}; 17 use um::winuser::{NMHDR, WM_USER}; 18 FN!{stdcall LPOFNHOOKPROC( 19 HWND, 20 UINT, 21 WPARAM, 22 LPARAM, 23 ) -> UINT_PTR} 24 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPENFILENAME_NT4A { 25 lStructSize: DWORD, 26 hwndOwner: HWND, 27 hInstance: HINSTANCE, 28 lpstrFilter: LPCSTR, 29 lpstrCustomFilter: LPSTR, 30 nMaxCustFilter: DWORD, 31 nFilterIndex: DWORD, 32 lpstrFile: LPSTR, 33 nMaxFile: DWORD, 34 lpstrFileTitle: LPSTR, 35 nMaxFileTitle: DWORD, 36 lpstrInitialDir: LPCSTR, 37 lpstrTitle: LPCSTR, 38 Flags: DWORD, 39 nFileOffset: WORD, 40 nFileExtension: WORD, 41 lpstrDefExt: LPCSTR, 42 lCustData: LPARAM, 43 lpfnHook: LPOFNHOOKPROC, 44 lpTemplateName: LPCSTR, 45 }} 46 pub type LPOPENFILENAME_NT4A = *mut OPENFILENAME_NT4A; 47 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPENFILENAME_NT4W { 48 lStructSize: DWORD, 49 hwndOwner: HWND, 50 hInstance: HINSTANCE, 51 lpstrFilter: LPCWSTR, 52 lpstrCustomFilter: LPWSTR, 53 nMaxCustFilter: DWORD, 54 nFilterIndex: DWORD, 55 lpstrFile: LPWSTR, 56 nMaxFile: DWORD, 57 lpstrFileTitle: LPWSTR, 58 nMaxFileTitle: DWORD, 59 lpstrInitialDir: LPCWSTR, 60 lpstrTitle: LPCWSTR, 61 Flags: DWORD, 62 nFileOffset: WORD, 63 nFileExtension: WORD, 64 lpstrDefExt: LPCWSTR, 65 lCustData: LPARAM, 66 lpfnHook: LPOFNHOOKPROC, 67 lpTemplateName: LPCWSTR, 68 }} 69 pub type LPOPENFILENAME_NT4W = *mut OPENFILENAME_NT4W; 70 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPENFILENAMEA { 71 lStructSize: DWORD, 72 hwndOwner: HWND, 73 hInstance: HINSTANCE, 74 lpstrFilter: LPCSTR, 75 lpstrCustomFilter: LPSTR, 76 nMaxCustFilter: DWORD, 77 nFilterIndex: DWORD, 78 lpstrFile: LPSTR, 79 nMaxFile: DWORD, 80 lpstrFileTitle: LPSTR, 81 nMaxFileTitle: DWORD, 82 lpstrInitialDir: LPCSTR, 83 lpstrTitle: LPCSTR, 84 Flags: DWORD, 85 nFileOffset: WORD, 86 nFileExtension: WORD, 87 lpstrDefExt: LPCSTR, 88 lCustData: LPARAM, 89 lpfnHook: LPOFNHOOKPROC, 90 lpTemplateName: LPCSTR, 91 pvReserved: *mut c_void, 92 dwReserved: DWORD, 93 FlagsEx: DWORD, 94 }} 95 pub type LPOPENFILENAMEA = *mut OPENFILENAMEA; 96 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OPENFILENAMEW { 97 lStructSize: DWORD, 98 hwndOwner: HWND, 99 hInstance: HINSTANCE, 100 lpstrFilter: LPCWSTR, 101 lpstrCustomFilter: LPWSTR, 102 nMaxCustFilter: DWORD, 103 nFilterIndex: DWORD, 104 lpstrFile: LPWSTR, 105 nMaxFile: DWORD, 106 lpstrFileTitle: LPWSTR, 107 nMaxFileTitle: DWORD, 108 lpstrInitialDir: LPCWSTR, 109 lpstrTitle: LPCWSTR, 110 Flags: DWORD, 111 nFileOffset: WORD, 112 nFileExtension: WORD, 113 lpstrDefExt: LPCWSTR, 114 lCustData: LPARAM, 115 lpfnHook: LPOFNHOOKPROC, 116 lpTemplateName: LPCWSTR, 117 pvReserved: *mut c_void, 118 dwReserved: DWORD, 119 FlagsEx: DWORD, 120 }} 121 pub type LPOPENFILENAMEW = *mut OPENFILENAMEW; 122 extern "system" { GetOpenFileNameA( lpofn: LPOPENFILENAMEA, ) -> BOOL123 pub fn GetOpenFileNameA( 124 lpofn: LPOPENFILENAMEA, 125 ) -> BOOL; GetOpenFileNameW( lpofn: LPOPENFILENAMEW, ) -> BOOL126 pub fn GetOpenFileNameW( 127 lpofn: LPOPENFILENAMEW, 128 ) -> BOOL; GetSaveFileNameA( lpofn: LPOPENFILENAMEA, ) -> BOOL129 pub fn GetSaveFileNameA( 130 lpofn: LPOPENFILENAMEA, 131 ) -> BOOL; GetSaveFileNameW( lpofn: LPOPENFILENAMEW, ) -> BOOL132 pub fn GetSaveFileNameW( 133 lpofn: LPOPENFILENAMEW, 134 ) -> BOOL; GetFileTitleA( lpszFile: LPCSTR, Buf: LPSTR, cchSize: WORD, ) -> c_short135 pub fn GetFileTitleA( 136 lpszFile: LPCSTR, 137 Buf: LPSTR, 138 cchSize: WORD, 139 ) -> c_short; GetFileTitleW( lpszFile: LPCWSTR, Buf: LPWSTR, cchSize: WORD, ) -> c_short140 pub fn GetFileTitleW( 141 lpszFile: LPCWSTR, 142 Buf: LPWSTR, 143 cchSize: WORD, 144 ) -> c_short; 145 } 146 pub const OFN_READONLY: DWORD = 0x00000001; 147 pub const OFN_OVERWRITEPROMPT: DWORD = 0x00000002; 148 pub const OFN_HIDEREADONLY: DWORD = 0x00000004; 149 pub const OFN_NOCHANGEDIR: DWORD = 0x00000008; 150 pub const OFN_SHOWHELP: DWORD = 0x00000010; 151 pub const OFN_ENABLEHOOK: DWORD = 0x00000020; 152 pub const OFN_ENABLETEMPLATE: DWORD = 0x00000040; 153 pub const OFN_ENABLETEMPLATEHANDLE: DWORD = 0x00000080; 154 pub const OFN_NOVALIDATE: DWORD = 0x00000100; 155 pub const OFN_ALLOWMULTISELECT: DWORD = 0x00000200; 156 pub const OFN_EXTENSIONDIFFERENT: DWORD = 0x00000400; 157 pub const OFN_PATHMUSTEXIST: DWORD = 0x00000800; 158 pub const OFN_FILEMUSTEXIST: DWORD = 0x00001000; 159 pub const OFN_CREATEPROMPT: DWORD = 0x00002000; 160 pub const OFN_SHAREAWARE: DWORD = 0x00004000; 161 pub const OFN_NOREADONLYRETURN: DWORD = 0x00008000; 162 pub const OFN_NOTESTFILECREATE: DWORD = 0x00010000; 163 pub const OFN_NONETWORKBUTTON: DWORD = 0x00020000; 164 pub const OFN_NOLONGNAMES: DWORD = 0x00040000; 165 pub const OFN_EXPLORER: DWORD = 0x00080000; 166 pub const OFN_NODEREFERENCELINKS: DWORD = 0x00100000; 167 pub const OFN_LONGNAMES: DWORD = 0x00200000; 168 pub const OFN_ENABLEINCLUDENOTIFY: DWORD = 0x00400000; 169 pub const OFN_ENABLESIZING: DWORD = 0x00800000; 170 pub const OFN_DONTADDTORECENT: DWORD = 0x02000000; 171 pub const OFN_FORCESHOWHIDDEN: DWORD = 0x10000000; 172 pub const OFN_EX_NOPLACESBAR: DWORD = 0x00000001; 173 pub const OFN_SHAREFALLTHROUGH: UINT_PTR = 2; 174 pub const OFN_SHARENOWARN: UINT_PTR = 1; 175 pub const OFN_SHAREWARN: UINT_PTR = 0; 176 FN!{stdcall LPCCHOOKPROC( 177 HWND, 178 UINT, 179 WPARAM, 180 LPARAM, 181 ) -> UINT_PTR} 182 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYA { 183 hdr: NMHDR, 184 lpOFN: LPOPENFILENAMEA, 185 pszFile: LPSTR, 186 }} 187 pub type LPOFNOTIFYA = *mut OFNOTIFYA; 188 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYW { 189 hdr: NMHDR, 190 lpOFN: LPOPENFILENAMEW, 191 pszFile: LPWSTR, 192 }} 193 pub type LPOFNOTIFYW = *mut OFNOTIFYW; 194 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYEXA { 195 hdr: NMHDR, 196 lpOFN: LPOPENFILENAMEA, 197 psf: LPVOID, 198 pidl: LPVOID, 199 }} 200 pub type LPOFNOTIFYEXA = *mut OFNOTIFYEXA; 201 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYEXW { 202 hdr: NMHDR, 203 lpOFN: LPOPENFILENAMEW, 204 psf: LPVOID, 205 pidl: LPVOID, 206 }} 207 pub type LPOFNOTIFYEXW = *mut OFNOTIFYEXW; 208 pub const CDN_FIRST: UINT = -601i32 as u32; 209 pub const CDN_LAST: UINT = -699i32 as u32; 210 pub const CDN_INITDONE: UINT = CDN_FIRST - 0x0000; 211 pub const CDN_SELCHANGE: UINT = CDN_FIRST - 0x0001; 212 pub const CDN_FOLDERCHANGE: UINT = CDN_FIRST - 0x0002; 213 pub const CDN_SHAREVIOLATION: UINT = CDN_FIRST - 0x0003; 214 pub const CDN_HELP: UINT = CDN_FIRST - 0x0004; 215 pub const CDN_FILEOK: UINT = CDN_FIRST - 0x0005; 216 pub const CDN_TYPECHANGE: UINT = CDN_FIRST - 0x0006; 217 pub const CDN_INCLUDEITEM: UINT = CDN_FIRST - 0x0007; 218 pub const CDM_FIRST: UINT = WM_USER + 100; 219 pub const CDM_LAST: UINT = WM_USER + 200; 220 pub const CDM_GETSPEC: UINT = CDM_FIRST + 0x0000; 221 pub const CDM_GETFILEPATH: UINT = CDM_FIRST + 0x0001; 222 pub const CDM_GETFOLDERPATH: UINT = CDM_FIRST + 0x0002; 223 pub const CDM_GETFOLDERIDLIST: UINT = CDM_FIRST + 0x0003; 224 pub const CDM_SETCONTROLTEXT: UINT = CDM_FIRST + 0x0004; 225 pub const CDM_HIDECONTROL: UINT = CDM_FIRST + 0x0005; 226 pub const CDM_SETDEFEXT: UINT = CDM_FIRST + 0x0006; 227 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct CHOOSECOLORA { 228 lStructSize: DWORD, 229 hwndOwner: HWND, 230 hInstance: HWND, 231 rgbResult: COLORREF, 232 lpCustColors: *mut COLORREF, 233 Flags: DWORD, 234 lCustData: LPARAM, 235 lpfnHook: LPCCHOOKPROC, 236 lpTemplateName: LPCSTR, 237 }} 238 pub type LPCHOOSECOLORA = *mut CHOOSECOLORA; 239 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct CHOOSECOLORW { 240 lStructSize: DWORD, 241 hwndOwner: HWND, 242 hInstance: HWND, 243 rgbResult: COLORREF, 244 lpCustColors: *mut COLORREF, 245 Flags: DWORD, 246 lCustData: LPARAM, 247 lpfnHook: LPCCHOOKPROC, 248 lpTemplateName: LPCWSTR, 249 }} 250 pub type LPCHOOSECOLORW = *mut CHOOSECOLORW; 251 extern "system" { ChooseColorA( lpcc: LPCHOOSECOLORA, ) -> BOOL252 pub fn ChooseColorA( 253 lpcc: LPCHOOSECOLORA, 254 ) -> BOOL; ChooseColorW( lpcc: LPCHOOSECOLORW, ) -> BOOL255 pub fn ChooseColorW( 256 lpcc: LPCHOOSECOLORW, 257 ) -> BOOL; 258 } 259 pub const CC_RGBINIT: DWORD = 0x00000001; 260 pub const CC_FULLOPEN: DWORD = 0x00000002; 261 pub const CC_PREVENTFULLOPEN: DWORD = 0x00000004; 262 pub const CC_SHOWHELP: DWORD = 0x00000008; 263 pub const CC_ENABLEHOOK: DWORD = 0x00000010; 264 pub const CC_ENABLETEMPLATE: DWORD = 0x00000020; 265 pub const CC_ENABLETEMPLATEHANDLE: DWORD = 0x00000040; 266 pub const CC_SOLIDCOLOR: DWORD = 0x00000080; 267 pub const CC_ANYCOLOR: DWORD = 0x00000100; 268 FN!{stdcall LPFRHOOKPROC( 269 HWND, 270 UINT, 271 WPARAM, 272 LPARAM, 273 ) -> UINT_PTR} 274 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct FINDREPLACEA { 275 lStructSize: DWORD, 276 hwndOwner: HWND, 277 hInstance: HINSTANCE, 278 Flags: DWORD, 279 lpstrFindWhat: LPSTR, 280 lpstrReplaceWith: LPSTR, 281 wFindWhatLen: WORD, 282 wReplaceWithLen: WORD, 283 lCustData: LPARAM, 284 lpfnHook: LPFRHOOKPROC, 285 lpTemplateName: LPCSTR, 286 }} 287 pub type LPFINDREPLACEA = *mut FINDREPLACEA; 288 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct FINDREPLACEW { 289 lStructSize: DWORD, 290 hwndOwner: HWND, 291 hInstance: HINSTANCE, 292 Flags: DWORD, 293 lpstrFindWhat: LPWSTR, 294 lpstrReplaceWith: LPWSTR, 295 wFindWhatLen: WORD, 296 wReplaceWithLen: WORD, 297 lCustData: LPARAM, 298 lpfnHook: LPFRHOOKPROC, 299 lpTemplateName: LPCWSTR, 300 }} 301 pub type LPFINDREPLACEW = *mut FINDREPLACEW; 302 pub const FR_DOWN: DWORD = 0x00000001; 303 pub const FR_WHOLEWORD: DWORD = 0x00000002; 304 pub const FR_MATCHCASE: DWORD = 0x00000004; 305 pub const FR_FINDNEXT: DWORD = 0x00000008; 306 pub const FR_REPLACE: DWORD = 0x00000010; 307 pub const FR_REPLACEALL: DWORD = 0x00000020; 308 pub const FR_DIALOGTERM: DWORD = 0x00000040; 309 pub const FR_SHOWHELP: DWORD = 0x00000080; 310 pub const FR_ENABLEHOOK: DWORD = 0x00000100; 311 pub const FR_ENABLETEMPLATE: DWORD = 0x00000200; 312 pub const FR_NOUPDOWN: DWORD = 0x00000400; 313 pub const FR_NOMATCHCASE: DWORD = 0x00000800; 314 pub const FR_NOWHOLEWORD: DWORD = 0x00001000; 315 pub const FR_ENABLETEMPLATEHANDLE: DWORD = 0x00002000; 316 pub const FR_HIDEUPDOWN: DWORD = 0x00004000; 317 pub const FR_HIDEMATCHCASE: DWORD = 0x00008000; 318 pub const FR_HIDEWHOLEWORD: DWORD = 0x00010000; 319 pub const FR_RAW: DWORD = 0x00020000; 320 pub const FR_MATCHDIAC: DWORD = 0x20000000; 321 pub const FR_MATCHKASHIDA: DWORD = 0x40000000; 322 pub const FR_MATCHALEFHAMZA: DWORD = 0x80000000; 323 extern "system" { FindTextA( lpfr: LPFINDREPLACEA, ) -> HWND324 pub fn FindTextA( 325 lpfr: LPFINDREPLACEA, 326 ) -> HWND; FindTextW( lpfr: LPFINDREPLACEW, ) -> HWND327 pub fn FindTextW( 328 lpfr: LPFINDREPLACEW, 329 ) -> HWND; ReplaceTextA( lpfr: LPFINDREPLACEA, ) -> HWND330 pub fn ReplaceTextA( 331 lpfr: LPFINDREPLACEA, 332 ) -> HWND; ReplaceTextW( lpfr: LPFINDREPLACEW, ) -> HWND333 pub fn ReplaceTextW( 334 lpfr: LPFINDREPLACEW, 335 ) -> HWND; 336 } 337 FN!{stdcall LPCFHOOKPROC( 338 HWND, 339 UINT, 340 WPARAM, 341 LPARAM, 342 ) -> UINT_PTR} 343 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct CHOOSEFONTA { 344 lStructSize: DWORD, 345 hwndOwner: HWND, 346 hDC: HDC, 347 lpLogFont: LPLOGFONTA, 348 iPointSize: INT, 349 Flags: DWORD, 350 rgbColors: COLORREF, 351 lCustData: LPARAM, 352 lpfnHook: LPCFHOOKPROC, 353 lpTemplateName: LPCSTR, 354 hInstance: HINSTANCE, 355 lpszStyle: LPSTR, 356 nFontType: WORD, 357 ___MISSING_ALIGNMENT__: WORD, 358 nSizeMin: INT, 359 nSizeMax: INT, 360 }} 361 pub type LPCHOOSEFONTA = *mut CHOOSEFONTA; 362 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct CHOOSEFONTW { 363 lStructSize: DWORD, 364 hwndOwner: HWND, 365 hDC: HDC, 366 lpLogFont: LPLOGFONTW, 367 iPointSize: INT, 368 Flags: DWORD, 369 rgbColors: COLORREF, 370 lCustData: LPARAM, 371 lpfnHook: LPCFHOOKPROC, 372 lpTemplateName: LPCWSTR, 373 hInstance: HINSTANCE, 374 lpszStyle: LPWSTR, 375 nFontType: WORD, 376 ___MISSING_ALIGNMENT__: WORD, 377 nSizeMin: INT, 378 nSizeMax: INT, 379 }} 380 pub type LPCHOOSEFONTW = *mut CHOOSEFONTW; 381 extern "system" { ChooseFontA( lpcf: LPCHOOSEFONTA, ) -> BOOL382 pub fn ChooseFontA( 383 lpcf: LPCHOOSEFONTA, 384 ) -> BOOL; ChooseFontW( lpcf: LPCHOOSEFONTW, ) -> BOOL385 pub fn ChooseFontW( 386 lpcf: LPCHOOSEFONTW, 387 ) -> BOOL; 388 } 389 pub const CF_SCREENFONTS: DWORD = 0x00000001; 390 pub const CF_PRINTERFONTS: DWORD = 0x00000002; 391 pub const CF_BOTH: DWORD = CF_SCREENFONTS | CF_PRINTERFONTS; 392 pub const CF_SHOWHELP: DWORD = 0x00000004; 393 pub const CF_ENABLEHOOK: DWORD = 0x00000008; 394 pub const CF_ENABLETEMPLATE: DWORD = 0x00000010; 395 pub const CF_ENABLETEMPLATEHANDLE: DWORD = 0x00000020; 396 pub const CF_INITTOLOGFONTSTRUCT: DWORD = 0x00000040; 397 pub const CF_USESTYLE: DWORD = 0x00000080; 398 pub const CF_EFFECTS: DWORD = 0x00000100; 399 pub const CF_APPLY: DWORD = 0x00000200; 400 pub const CF_ANSIONLY: DWORD = 0x00000400; 401 pub const CF_SCRIPTSONLY: DWORD = CF_ANSIONLY; 402 pub const CF_NOVECTORFONTS: DWORD = 0x00000800; 403 pub const CF_NOOEMFONTS: DWORD = CF_NOVECTORFONTS; 404 pub const CF_NOSIMULATIONS: DWORD = 0x00001000; 405 pub const CF_LIMITSIZE: DWORD = 0x00002000; 406 pub const CF_FIXEDPITCHONLY: DWORD = 0x00004000; 407 pub const CF_WYSIWYG: DWORD = 0x00008000; 408 pub const CF_FORCEFONTEXIST: DWORD = 0x00010000; 409 pub const CF_SCALABLEONLY: DWORD = 0x00020000; 410 pub const CF_TTONLY: DWORD = 0x00040000; 411 pub const CF_NOFACESEL: DWORD = 0x00080000; 412 pub const CF_NOSTYLESEL: DWORD = 0x00100000; 413 pub const CF_NOSIZESEL: DWORD = 0x00200000; 414 pub const CF_SELECTSCRIPT: DWORD = 0x00400000; 415 pub const CF_NOSCRIPTSEL: DWORD = 0x00800000; 416 pub const CF_NOVERTFONTS: DWORD = 0x01000000; 417 pub const CF_INACTIVEFONTS: DWORD = 0x02000000; 418 pub const SIMULATED_FONTTYPE: WORD = 0x8000; 419 pub const PRINTER_FONTTYPE: WORD = 0x4000; 420 pub const SCREEN_FONTTYPE: WORD = 0x2000; 421 pub const BOLD_FONTTYPE: WORD = 0x0100; 422 pub const ITALIC_FONTTYPE: WORD = 0x0200; 423 pub const REGULAR_FONTTYPE: WORD = 0x0400; 424 pub const PS_OPENTYPE_FONTTYPE: DWORD = 0x10000; 425 pub const TT_OPENTYPE_FONTTYPE: DWORD = 0x20000; 426 pub const TYPE1_FONTTYPE: DWORD = 0x40000; 427 pub const SYMBOL_FONTTYPE: DWORD = 0x80000; 428 pub const WM_CHOOSEFONT_GETLOGFONT: UINT = WM_USER + 1; 429 pub const WM_CHOOSEFONT_SETLOGFONT: UINT = WM_USER + 101; 430 pub const WM_CHOOSEFONT_SETFLAGS: UINT = WM_USER + 102; 431 pub const CD_LBSELNOITEMS: WORD = -1i16 as u16; 432 pub const CD_LBSELCHANGE: WORD = 0; 433 pub const CD_LBSELSUB: WORD = 1; 434 pub const CD_LBSELADD: WORD = 2; 435 FN!{stdcall LPPRINTHOOKPROC( 436 HWND, 437 UINT, 438 WPARAM, 439 LPARAM, 440 ) -> UINT_PTR} 441 FN!{stdcall LPSETUPHOOKPROC( 442 HWND, 443 UINT, 444 WPARAM, 445 LPARAM, 446 ) -> UINT_PTR} 447 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PRINTDLGA { 448 lStructSize: DWORD, 449 hwndOwner: HWND, 450 hDevMode: HGLOBAL, 451 hDevNames: HGLOBAL, 452 hDC: HDC, 453 Flags: DWORD, 454 nFromPage: WORD, 455 nToPage: WORD, 456 nMinPage: WORD, 457 nMaxPage: WORD, 458 nCopies: WORD, 459 hInstance: HINSTANCE, 460 lCustData: LPARAM, 461 lpfnPrintHook: LPPRINTHOOKPROC, 462 lpfnSetupHook: LPSETUPHOOKPROC, 463 lpPrintTemplateName: LPCSTR, 464 lpSetupTemplateName: LPCSTR, 465 hPrintTemplate: HGLOBAL, 466 hSetupTemplate: HGLOBAL, 467 }} 468 pub type LPPRINTDLGA = *mut PRINTDLGA; 469 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PRINTDLGW { 470 lStructSize: DWORD, 471 hwndOwner: HWND, 472 hDevMode: HGLOBAL, 473 hDevNames: HGLOBAL, 474 hDC: HDC, 475 Flags: DWORD, 476 nFromPage: WORD, 477 nToPage: WORD, 478 nMinPage: WORD, 479 nMaxPage: WORD, 480 nCopies: WORD, 481 hInstance: HINSTANCE, 482 lCustData: LPARAM, 483 lpfnPrintHook: LPPRINTHOOKPROC, 484 lpfnSetupHook: LPSETUPHOOKPROC, 485 lpPrintTemplateName: LPCWSTR, 486 lpSetupTemplateName: LPCWSTR, 487 hPrintTemplate: HGLOBAL, 488 hSetupTemplate: HGLOBAL, 489 }} 490 pub type LPPRINTDLGW = *mut PRINTDLGW; 491 extern "system" { PrintDlgA( pPD: LPPRINTDLGA, ) -> BOOL492 pub fn PrintDlgA( 493 pPD: LPPRINTDLGA, 494 ) -> BOOL; PrintDlgW( pPD: LPPRINTDLGW, ) -> BOOL495 pub fn PrintDlgW( 496 pPD: LPPRINTDLGW, 497 ) -> BOOL; 498 } 499 RIDL!{#[uuid(0x5852a2c3, 0x6530, 0x11d1, 0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9)] 500 interface IPrintDialogCallback(IPrintDialogCallbackVtbl): IUnknown(IUnknownVtbl) { 501 fn InitDone() -> HRESULT, 502 fn SelectionChange() -> HRESULT, 503 fn HandleMessage( 504 hDlg: HWND, 505 uMsg: UINT, 506 wParam: WPARAM, 507 lParam: LPARAM, 508 pResult: *mut LRESULT, 509 ) -> HRESULT, 510 }} 511 RIDL!{#[uuid(0x509aaeda, 0x5639, 0x11d1, 0xb6, 0xa1, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9)] 512 interface IPrintDialogServices(IPrintDialogServicesVtbl): IUnknown(IUnknownVtbl) { 513 fn GetCurrentDevMode( 514 pDevMode: LPDEVMODEW, 515 pcbSize: *mut UINT, 516 ) -> HRESULT, 517 fn GetCurrentPrinterName( 518 pPrinterName: LPWSTR, 519 pcchSize: *mut UINT, 520 ) -> HRESULT, 521 fn GetCurrentPortName( 522 pPortName: LPWSTR, 523 pcchSize: *mut UINT, 524 ) -> HRESULT, 525 }} 526 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PRINTPAGERANGE { 527 nFromPage: DWORD, 528 nToPage: DWORD, 529 }} 530 pub type LPPRINTPAGERANGE = *mut PRINTPAGERANGE; 531 pub type PCPRINTPAGERANGE = *const PRINTPAGERANGE; 532 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PRINTDLGEXA { 533 lStructSize: DWORD, 534 hwndOwner: HWND, 535 hDevMode: HGLOBAL, 536 hDevNames: HGLOBAL, 537 hDC: HDC, 538 Flags: DWORD, 539 Flags2: DWORD, 540 ExclusionFlags: DWORD, 541 nPageRanges: DWORD, 542 nMaxPageRanges: DWORD, 543 lpPageRanges: LPPRINTPAGERANGE, 544 nMinPage: DWORD, 545 nMaxPage: DWORD, 546 nCopies: DWORD, 547 hInstance: HINSTANCE, 548 lpPrintTemplateName: LPCSTR, 549 lpCallback: LPUNKNOWN, 550 nPropertyPages: DWORD, 551 lphPropertyPages: *mut HPROPSHEETPAGE, 552 nStartPage: DWORD, 553 dwResultAction: DWORD, 554 }} 555 pub type LPPRINTDLGEXA = *mut PRINTDLGEXA; 556 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PRINTDLGEXW { 557 lStructSize: DWORD, 558 hwndOwner: HWND, 559 hDevMode: HGLOBAL, 560 hDevNames: HGLOBAL, 561 hDC: HDC, 562 Flags: DWORD, 563 Flags2: DWORD, 564 ExclusionFlags: DWORD, 565 nPageRanges: DWORD, 566 nMaxPageRanges: DWORD, 567 lpPageRanges: LPPRINTPAGERANGE, 568 nMinPage: DWORD, 569 nMaxPage: DWORD, 570 nCopies: DWORD, 571 hInstance: HINSTANCE, 572 lpPrintTemplateName: LPCWSTR, 573 lpCallback: LPUNKNOWN, 574 nPropertyPages: DWORD, 575 lphPropertyPages: *mut HPROPSHEETPAGE, 576 nStartPage: DWORD, 577 dwResultAction: DWORD, 578 }} 579 pub type LPPRINTDLGEXW = *mut PRINTDLGEXW; 580 extern "system" { PrintDlgExA( pPD: LPPRINTDLGEXA, ) -> HRESULT581 pub fn PrintDlgExA( 582 pPD: LPPRINTDLGEXA, 583 ) -> HRESULT; PrintDlgExW( pPD: LPPRINTDLGEXW, ) -> HRESULT584 pub fn PrintDlgExW( 585 pPD: LPPRINTDLGEXW, 586 ) -> HRESULT; 587 } 588 pub const PD_ALLPAGES: DWORD = 0x00000000; 589 pub const PD_SELECTION: DWORD = 0x00000001; 590 pub const PD_PAGENUMS: DWORD = 0x00000002; 591 pub const PD_NOSELECTION: DWORD = 0x00000004; 592 pub const PD_NOPAGENUMS: DWORD = 0x00000008; 593 pub const PD_COLLATE: DWORD = 0x00000010; 594 pub const PD_PRINTTOFILE: DWORD = 0x00000020; 595 pub const PD_PRINTSETUP: DWORD = 0x00000040; 596 pub const PD_NOWARNING: DWORD = 0x00000080; 597 pub const PD_RETURNDC: DWORD = 0x00000100; 598 pub const PD_RETURNIC: DWORD = 0x00000200; 599 pub const PD_RETURNDEFAULT: DWORD = 0x00000400; 600 pub const PD_SHOWHELP: DWORD = 0x00000800; 601 pub const PD_ENABLEPRINTHOOK: DWORD = 0x00001000; 602 pub const PD_ENABLESETUPHOOK: DWORD = 0x00002000; 603 pub const PD_ENABLEPRINTTEMPLATE: DWORD = 0x00004000; 604 pub const PD_ENABLESETUPTEMPLATE: DWORD = 0x00008000; 605 pub const PD_ENABLEPRINTTEMPLATEHANDLE: DWORD = 0x00010000; 606 pub const PD_ENABLESETUPTEMPLATEHANDLE: DWORD = 0x00020000; 607 pub const PD_USEDEVMODECOPIES: DWORD = 0x00040000; 608 pub const PD_USEDEVMODECOPIESANDCOLLATE: DWORD = 0x00040000; 609 pub const PD_DISABLEPRINTTOFILE: DWORD = 0x00080000; 610 pub const PD_HIDEPRINTTOFILE: DWORD = 0x00100000; 611 pub const PD_NONETWORKBUTTON: DWORD = 0x00200000; 612 pub const PD_CURRENTPAGE: DWORD = 0x00400000; 613 pub const PD_NOCURRENTPAGE: DWORD = 0x00800000; 614 pub const PD_EXCLUSIONFLAGS: DWORD = 0x01000000; 615 pub const PD_USELARGETEMPLATE: DWORD = 0x10000000; 616 pub const PD_EXCL_COPIESANDCOLLATE: DWORD = DM_COPIES | DM_COLLATE; 617 pub const START_PAGE_GENERAL: DWORD = 0xffffffff; 618 pub const PD_RESULT_CANCEL: DWORD = 0; 619 pub const PD_RESULT_PRINT: DWORD = 1; 620 pub const PD_RESULT_APPLY: DWORD = 2; 621 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct DEVNAMES { 622 wDriverOffset: WORD, 623 wDeviceOffset: WORD, 624 wOutputOffset: WORD, 625 wDefault: WORD, 626 }} 627 pub type LPDEVNAMES = *mut DEVNAMES; 628 pub type PCDEVNAMES = *const DEVNAMES; 629 pub const DN_DEFAULTPRN: WORD = 0x0001; 630 extern "system" { CommDlgExtendedError() -> DWORD631 pub fn CommDlgExtendedError() -> DWORD; 632 } 633 pub const WM_PSD_PAGESETUPDLG: UINT = WM_USER; 634 pub const WM_PSD_FULLPAGERECT: UINT = WM_USER + 1; 635 pub const WM_PSD_MINMARGINRECT: UINT = WM_USER + 2; 636 pub const WM_PSD_MARGINRECT: UINT = WM_USER + 3; 637 pub const WM_PSD_GREEKTEXTRECT: UINT = WM_USER + 4; 638 pub const WM_PSD_ENVSTAMPRECT: UINT = WM_USER + 5; 639 pub const WM_PSD_YAFULLPAGERECT: UINT = WM_USER + 6; 640 FN!{stdcall LPPAGEPAINTHOOK( 641 HWND, 642 UINT, 643 WPARAM, 644 LPARAM, 645 ) -> UINT_PTR} 646 FN!{stdcall LPPAGESETUPHOOK( 647 HWND, 648 UINT, 649 WPARAM, 650 LPARAM, 651 ) -> UINT_PTR} 652 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PAGESETUPDLGA { 653 lStructSize: DWORD, 654 hwndOwner: HWND, 655 hDevMode: HGLOBAL, 656 hDevNames: HGLOBAL, 657 Flags: DWORD, 658 ptPaperSize: POINT, 659 rtMinMargin: RECT, 660 rtMargin: RECT, 661 hInstance: HINSTANCE, 662 lCustData: LPARAM, 663 lpfnPageSetupHook: LPPAGESETUPHOOK, 664 lpfnPagePaintHook: LPPAGEPAINTHOOK, 665 lpPageSetupTemplateName: LPCSTR, 666 hPageSetupTemplate: HGLOBAL, 667 }} 668 pub type LPPAGESETUPDLGA = *mut PAGESETUPDLGA; 669 STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PAGESETUPDLGW { 670 lStructSize: DWORD, 671 hwndOwner: HWND, 672 hDevMode: HGLOBAL, 673 hDevNames: HGLOBAL, 674 Flags: DWORD, 675 ptPaperSize: POINT, 676 rtMinMargin: RECT, 677 rtMargin: RECT, 678 hInstance: HINSTANCE, 679 lCustData: LPARAM, 680 lpfnPageSetupHook: LPPAGESETUPHOOK, 681 lpfnPagePaintHook: LPPAGEPAINTHOOK, 682 lpPageSetupTemplateName: LPCWSTR, 683 hPageSetupTemplate: HGLOBAL, 684 }} 685 pub type LPPAGESETUPDLGW = *mut PAGESETUPDLGW; 686 extern "system" { PageSetupDlgA( lppsd: LPPAGESETUPDLGA, ) -> BOOL687 pub fn PageSetupDlgA( 688 lppsd: LPPAGESETUPDLGA, 689 ) -> BOOL; PageSetupDlgW( lppsd: LPPAGESETUPDLGW, ) -> BOOL690 pub fn PageSetupDlgW( 691 lppsd: LPPAGESETUPDLGW, 692 ) -> BOOL; 693 } 694 pub const PSD_DEFAULTMINMARGINS: DWORD = 0x00000000; 695 pub const PSD_INWININIINTLMEASURE: DWORD = 0x00000000; 696 pub const PSD_MINMARGINS: DWORD = 0x00000001; 697 pub const PSD_MARGINS: DWORD = 0x00000002; 698 pub const PSD_INTHOUSANDTHSOFINCHES: DWORD = 0x00000004; 699 pub const PSD_INHUNDREDTHSOFMILLIMETERS: DWORD = 0x00000008; 700 pub const PSD_DISABLEMARGINS: DWORD = 0x00000010; 701 pub const PSD_DISABLEPRINTER: DWORD = 0x00000020; 702 pub const PSD_NOWARNING: DWORD = 0x00000080; 703 pub const PSD_DISABLEORIENTATION: DWORD = 0x00000100; 704 pub const PSD_RETURNDEFAULT: DWORD = 0x00000400; 705 pub const PSD_DISABLEPAPER: DWORD = 0x00000200; 706 pub const PSD_SHOWHELP: DWORD = 0x00000800; 707 pub const PSD_ENABLEPAGESETUPHOOK: DWORD = 0x00002000; 708 pub const PSD_ENABLEPAGESETUPTEMPLATE: DWORD = 0x00008000; 709 pub const PSD_ENABLEPAGESETUPTEMPLATEHANDLE: DWORD = 0x00020000; 710 pub const PSD_ENABLEPAGEPAINTHOOK: DWORD = 0x00040000; 711 pub const PSD_DISABLEPAGEPAINTING: DWORD = 0x00080000; 712 pub const PSD_NONETWORKBUTTON: DWORD = 0x00200000; 713