winapi_ui_automation/um/
commdlg.rs

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
7use ctypes::{c_short, c_void};
8use shared::basetsd::UINT_PTR;
9use shared::minwindef::{
10    BOOL, DWORD, HGLOBAL, HINSTANCE, INT, LPARAM, LPVOID, LRESULT, UINT, WORD, WPARAM,
11};
12use shared::windef::{COLORREF, HDC, HWND, POINT, RECT};
13use um::prsht::HPROPSHEETPAGE;
14use um::unknwnbase::{IUnknown, IUnknownVtbl, LPUNKNOWN};
15use um::wingdi::{DM_COLLATE, DM_COPIES, LPDEVMODEW, LPLOGFONTA, LPLOGFONTW};
16use um::winnt::{HRESULT, LPCSTR, LPCWSTR, LPSTR, LPWSTR};
17use um::winuser::{NMHDR, WM_USER};
18FN!{stdcall LPOFNHOOKPROC(
19    HWND,
20    UINT,
21    WPARAM,
22    LPARAM,
23) -> UINT_PTR}
24STRUCT!{#[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}}
46pub type LPOPENFILENAME_NT4A = *mut OPENFILENAME_NT4A;
47STRUCT!{#[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}}
69pub type LPOPENFILENAME_NT4W = *mut OPENFILENAME_NT4W;
70STRUCT!{#[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}}
95pub type LPOPENFILENAMEA = *mut OPENFILENAMEA;
96STRUCT!{#[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}}
121pub type LPOPENFILENAMEW = *mut OPENFILENAMEW;
122extern "system" {
123    pub fn GetOpenFileNameA(
124        lpofn: LPOPENFILENAMEA,
125    ) -> BOOL;
126    pub fn GetOpenFileNameW(
127        lpofn: LPOPENFILENAMEW,
128    ) -> BOOL;
129    pub fn GetSaveFileNameA(
130        lpofn: LPOPENFILENAMEA,
131    ) -> BOOL;
132    pub fn GetSaveFileNameW(
133        lpofn: LPOPENFILENAMEW,
134    ) -> BOOL;
135    pub fn GetFileTitleA(
136        lpszFile: LPCSTR,
137        Buf: LPSTR,
138        cchSize: WORD,
139    ) -> c_short;
140    pub fn GetFileTitleW(
141        lpszFile: LPCWSTR,
142        Buf: LPWSTR,
143        cchSize: WORD,
144    ) -> c_short;
145}
146pub const OFN_READONLY: DWORD = 0x00000001;
147pub const OFN_OVERWRITEPROMPT: DWORD = 0x00000002;
148pub const OFN_HIDEREADONLY: DWORD = 0x00000004;
149pub const OFN_NOCHANGEDIR: DWORD = 0x00000008;
150pub const OFN_SHOWHELP: DWORD = 0x00000010;
151pub const OFN_ENABLEHOOK: DWORD = 0x00000020;
152pub const OFN_ENABLETEMPLATE: DWORD = 0x00000040;
153pub const OFN_ENABLETEMPLATEHANDLE: DWORD = 0x00000080;
154pub const OFN_NOVALIDATE: DWORD = 0x00000100;
155pub const OFN_ALLOWMULTISELECT: DWORD = 0x00000200;
156pub const OFN_EXTENSIONDIFFERENT: DWORD = 0x00000400;
157pub const OFN_PATHMUSTEXIST: DWORD = 0x00000800;
158pub const OFN_FILEMUSTEXIST: DWORD = 0x00001000;
159pub const OFN_CREATEPROMPT: DWORD = 0x00002000;
160pub const OFN_SHAREAWARE: DWORD = 0x00004000;
161pub const OFN_NOREADONLYRETURN: DWORD = 0x00008000;
162pub const OFN_NOTESTFILECREATE: DWORD = 0x00010000;
163pub const OFN_NONETWORKBUTTON: DWORD = 0x00020000;
164pub const OFN_NOLONGNAMES: DWORD = 0x00040000;
165pub const OFN_EXPLORER: DWORD = 0x00080000;
166pub const OFN_NODEREFERENCELINKS: DWORD = 0x00100000;
167pub const OFN_LONGNAMES: DWORD = 0x00200000;
168pub const OFN_ENABLEINCLUDENOTIFY: DWORD = 0x00400000;
169pub const OFN_ENABLESIZING: DWORD = 0x00800000;
170pub const OFN_DONTADDTORECENT: DWORD = 0x02000000;
171pub const OFN_FORCESHOWHIDDEN: DWORD = 0x10000000;
172pub const OFN_EX_NOPLACESBAR: DWORD = 0x00000001;
173pub const OFN_SHAREFALLTHROUGH: UINT_PTR = 2;
174pub const OFN_SHARENOWARN: UINT_PTR = 1;
175pub const OFN_SHAREWARN: UINT_PTR = 0;
176FN!{stdcall LPCCHOOKPROC(
177    HWND,
178    UINT,
179    WPARAM,
180    LPARAM,
181) -> UINT_PTR}
182STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYA {
183    hdr: NMHDR,
184    lpOFN: LPOPENFILENAMEA,
185    pszFile: LPSTR,
186}}
187pub type LPOFNOTIFYA = *mut OFNOTIFYA;
188STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYW {
189    hdr: NMHDR,
190    lpOFN: LPOPENFILENAMEW,
191    pszFile: LPWSTR,
192}}
193pub type LPOFNOTIFYW = *mut OFNOTIFYW;
194STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYEXA {
195    hdr: NMHDR,
196    lpOFN: LPOPENFILENAMEA,
197    psf: LPVOID,
198    pidl: LPVOID,
199}}
200pub type LPOFNOTIFYEXA = *mut OFNOTIFYEXA;
201STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct OFNOTIFYEXW {
202    hdr: NMHDR,
203    lpOFN: LPOPENFILENAMEW,
204    psf: LPVOID,
205    pidl: LPVOID,
206}}
207pub type LPOFNOTIFYEXW = *mut OFNOTIFYEXW;
208pub const CDN_FIRST: UINT = -601i32 as u32;
209pub const CDN_LAST: UINT = -699i32 as u32;
210pub const CDN_INITDONE: UINT = CDN_FIRST - 0x0000;
211pub const CDN_SELCHANGE: UINT = CDN_FIRST - 0x0001;
212pub const CDN_FOLDERCHANGE: UINT = CDN_FIRST - 0x0002;
213pub const CDN_SHAREVIOLATION: UINT = CDN_FIRST - 0x0003;
214pub const CDN_HELP: UINT = CDN_FIRST - 0x0004;
215pub const CDN_FILEOK: UINT = CDN_FIRST - 0x0005;
216pub const CDN_TYPECHANGE: UINT = CDN_FIRST - 0x0006;
217pub const CDN_INCLUDEITEM: UINT = CDN_FIRST - 0x0007;
218pub const CDM_FIRST: UINT = WM_USER + 100;
219pub const CDM_LAST: UINT = WM_USER + 200;
220pub const CDM_GETSPEC: UINT = CDM_FIRST + 0x0000;
221pub const CDM_GETFILEPATH: UINT = CDM_FIRST + 0x0001;
222pub const CDM_GETFOLDERPATH: UINT = CDM_FIRST + 0x0002;
223pub const CDM_GETFOLDERIDLIST: UINT = CDM_FIRST + 0x0003;
224pub const CDM_SETCONTROLTEXT: UINT = CDM_FIRST + 0x0004;
225pub const CDM_HIDECONTROL: UINT = CDM_FIRST + 0x0005;
226pub const CDM_SETDEFEXT: UINT = CDM_FIRST + 0x0006;
227STRUCT!{#[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}}
238pub type LPCHOOSECOLORA = *mut CHOOSECOLORA;
239STRUCT!{#[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}}
250pub type LPCHOOSECOLORW = *mut CHOOSECOLORW;
251extern "system" {
252    pub fn ChooseColorA(
253        lpcc: LPCHOOSECOLORA,
254    ) -> BOOL;
255    pub fn ChooseColorW(
256        lpcc: LPCHOOSECOLORW,
257    ) -> BOOL;
258}
259pub const CC_RGBINIT: DWORD = 0x00000001;
260pub const CC_FULLOPEN: DWORD = 0x00000002;
261pub const CC_PREVENTFULLOPEN: DWORD = 0x00000004;
262pub const CC_SHOWHELP: DWORD = 0x00000008;
263pub const CC_ENABLEHOOK: DWORD = 0x00000010;
264pub const CC_ENABLETEMPLATE: DWORD = 0x00000020;
265pub const CC_ENABLETEMPLATEHANDLE: DWORD = 0x00000040;
266pub const CC_SOLIDCOLOR: DWORD = 0x00000080;
267pub const CC_ANYCOLOR: DWORD = 0x00000100;
268FN!{stdcall LPFRHOOKPROC(
269    HWND,
270    UINT,
271    WPARAM,
272    LPARAM,
273) -> UINT_PTR}
274STRUCT!{#[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}}
287pub type LPFINDREPLACEA = *mut FINDREPLACEA;
288STRUCT!{#[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}}
301pub type LPFINDREPLACEW = *mut FINDREPLACEW;
302pub const FR_DOWN: DWORD = 0x00000001;
303pub const FR_WHOLEWORD: DWORD = 0x00000002;
304pub const FR_MATCHCASE: DWORD = 0x00000004;
305pub const FR_FINDNEXT: DWORD = 0x00000008;
306pub const FR_REPLACE: DWORD = 0x00000010;
307pub const FR_REPLACEALL: DWORD = 0x00000020;
308pub const FR_DIALOGTERM: DWORD = 0x00000040;
309pub const FR_SHOWHELP: DWORD = 0x00000080;
310pub const FR_ENABLEHOOK: DWORD = 0x00000100;
311pub const FR_ENABLETEMPLATE: DWORD = 0x00000200;
312pub const FR_NOUPDOWN: DWORD = 0x00000400;
313pub const FR_NOMATCHCASE: DWORD = 0x00000800;
314pub const FR_NOWHOLEWORD: DWORD = 0x00001000;
315pub const FR_ENABLETEMPLATEHANDLE: DWORD = 0x00002000;
316pub const FR_HIDEUPDOWN: DWORD = 0x00004000;
317pub const FR_HIDEMATCHCASE: DWORD = 0x00008000;
318pub const FR_HIDEWHOLEWORD: DWORD = 0x00010000;
319pub const FR_RAW: DWORD = 0x00020000;
320pub const FR_MATCHDIAC: DWORD = 0x20000000;
321pub const FR_MATCHKASHIDA: DWORD = 0x40000000;
322pub const FR_MATCHALEFHAMZA: DWORD = 0x80000000;
323extern "system" {
324    pub fn FindTextA(
325        lpfr: LPFINDREPLACEA,
326    ) -> HWND;
327    pub fn FindTextW(
328        lpfr: LPFINDREPLACEW,
329    ) -> HWND;
330    pub fn ReplaceTextA(
331        lpfr: LPFINDREPLACEA,
332    ) -> HWND;
333    pub fn ReplaceTextW(
334        lpfr: LPFINDREPLACEW,
335    ) -> HWND;
336}
337FN!{stdcall LPCFHOOKPROC(
338    HWND,
339    UINT,
340    WPARAM,
341    LPARAM,
342) -> UINT_PTR}
343STRUCT!{#[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}}
361pub type LPCHOOSEFONTA = *mut CHOOSEFONTA;
362STRUCT!{#[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}}
380pub type LPCHOOSEFONTW = *mut CHOOSEFONTW;
381extern "system" {
382    pub fn ChooseFontA(
383        lpcf: LPCHOOSEFONTA,
384    ) -> BOOL;
385    pub fn ChooseFontW(
386        lpcf: LPCHOOSEFONTW,
387    ) -> BOOL;
388}
389pub const CF_SCREENFONTS: DWORD = 0x00000001;
390pub const CF_PRINTERFONTS: DWORD = 0x00000002;
391pub const CF_BOTH: DWORD = CF_SCREENFONTS | CF_PRINTERFONTS;
392pub const CF_SHOWHELP: DWORD = 0x00000004;
393pub const CF_ENABLEHOOK: DWORD = 0x00000008;
394pub const CF_ENABLETEMPLATE: DWORD = 0x00000010;
395pub const CF_ENABLETEMPLATEHANDLE: DWORD = 0x00000020;
396pub const CF_INITTOLOGFONTSTRUCT: DWORD = 0x00000040;
397pub const CF_USESTYLE: DWORD = 0x00000080;
398pub const CF_EFFECTS: DWORD = 0x00000100;
399pub const CF_APPLY: DWORD = 0x00000200;
400pub const CF_ANSIONLY: DWORD = 0x00000400;
401pub const CF_SCRIPTSONLY: DWORD = CF_ANSIONLY;
402pub const CF_NOVECTORFONTS: DWORD = 0x00000800;
403pub const CF_NOOEMFONTS: DWORD = CF_NOVECTORFONTS;
404pub const CF_NOSIMULATIONS: DWORD = 0x00001000;
405pub const CF_LIMITSIZE: DWORD = 0x00002000;
406pub const CF_FIXEDPITCHONLY: DWORD = 0x00004000;
407pub const CF_WYSIWYG: DWORD = 0x00008000;
408pub const CF_FORCEFONTEXIST: DWORD = 0x00010000;
409pub const CF_SCALABLEONLY: DWORD = 0x00020000;
410pub const CF_TTONLY: DWORD = 0x00040000;
411pub const CF_NOFACESEL: DWORD = 0x00080000;
412pub const CF_NOSTYLESEL: DWORD = 0x00100000;
413pub const CF_NOSIZESEL: DWORD = 0x00200000;
414pub const CF_SELECTSCRIPT: DWORD = 0x00400000;
415pub const CF_NOSCRIPTSEL: DWORD = 0x00800000;
416pub const CF_NOVERTFONTS: DWORD = 0x01000000;
417pub const CF_INACTIVEFONTS: DWORD = 0x02000000;
418pub const SIMULATED_FONTTYPE: WORD = 0x8000;
419pub const PRINTER_FONTTYPE: WORD = 0x4000;
420pub const SCREEN_FONTTYPE: WORD = 0x2000;
421pub const BOLD_FONTTYPE: WORD = 0x0100;
422pub const ITALIC_FONTTYPE: WORD = 0x0200;
423pub const REGULAR_FONTTYPE: WORD = 0x0400;
424pub const PS_OPENTYPE_FONTTYPE: DWORD = 0x10000;
425pub const TT_OPENTYPE_FONTTYPE: DWORD = 0x20000;
426pub const TYPE1_FONTTYPE: DWORD = 0x40000;
427pub const SYMBOL_FONTTYPE: DWORD = 0x80000;
428pub const WM_CHOOSEFONT_GETLOGFONT: UINT = WM_USER + 1;
429pub const WM_CHOOSEFONT_SETLOGFONT: UINT = WM_USER + 101;
430pub const WM_CHOOSEFONT_SETFLAGS: UINT = WM_USER + 102;
431pub const CD_LBSELNOITEMS: WORD = -1i16 as u16;
432pub const CD_LBSELCHANGE: WORD = 0;
433pub const CD_LBSELSUB: WORD = 1;
434pub const CD_LBSELADD: WORD = 2;
435FN!{stdcall LPPRINTHOOKPROC(
436    HWND,
437    UINT,
438    WPARAM,
439    LPARAM,
440) -> UINT_PTR}
441FN!{stdcall LPSETUPHOOKPROC(
442    HWND,
443    UINT,
444    WPARAM,
445    LPARAM,
446) -> UINT_PTR}
447STRUCT!{#[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}}
468pub type LPPRINTDLGA = *mut PRINTDLGA;
469STRUCT!{#[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}}
490pub type LPPRINTDLGW = *mut PRINTDLGW;
491extern "system" {
492    pub fn PrintDlgA(
493        pPD: LPPRINTDLGA,
494    ) -> BOOL;
495    pub fn PrintDlgW(
496        pPD: LPPRINTDLGW,
497    ) -> BOOL;
498}
499RIDL!{#[uuid(0x5852a2c3, 0x6530, 0x11d1, 0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9)]
500interface 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}}
511RIDL!{#[uuid(0x509aaeda, 0x5639, 0x11d1, 0xb6, 0xa1, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9)]
512interface 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}}
526STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct PRINTPAGERANGE {
527    nFromPage: DWORD,
528    nToPage: DWORD,
529}}
530pub type LPPRINTPAGERANGE = *mut PRINTPAGERANGE;
531pub type PCPRINTPAGERANGE = *const PRINTPAGERANGE;
532STRUCT!{#[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}}
555pub type LPPRINTDLGEXA = *mut PRINTDLGEXA;
556STRUCT!{#[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}}
579pub type LPPRINTDLGEXW = *mut PRINTDLGEXW;
580extern "system" {
581    pub fn PrintDlgExA(
582        pPD: LPPRINTDLGEXA,
583    ) -> HRESULT;
584    pub fn PrintDlgExW(
585        pPD: LPPRINTDLGEXW,
586    ) -> HRESULT;
587}
588pub const PD_ALLPAGES: DWORD = 0x00000000;
589pub const PD_SELECTION: DWORD = 0x00000001;
590pub const PD_PAGENUMS: DWORD = 0x00000002;
591pub const PD_NOSELECTION: DWORD = 0x00000004;
592pub const PD_NOPAGENUMS: DWORD = 0x00000008;
593pub const PD_COLLATE: DWORD = 0x00000010;
594pub const PD_PRINTTOFILE: DWORD = 0x00000020;
595pub const PD_PRINTSETUP: DWORD = 0x00000040;
596pub const PD_NOWARNING: DWORD = 0x00000080;
597pub const PD_RETURNDC: DWORD = 0x00000100;
598pub const PD_RETURNIC: DWORD = 0x00000200;
599pub const PD_RETURNDEFAULT: DWORD = 0x00000400;
600pub const PD_SHOWHELP: DWORD = 0x00000800;
601pub const PD_ENABLEPRINTHOOK: DWORD = 0x00001000;
602pub const PD_ENABLESETUPHOOK: DWORD = 0x00002000;
603pub const PD_ENABLEPRINTTEMPLATE: DWORD = 0x00004000;
604pub const PD_ENABLESETUPTEMPLATE: DWORD = 0x00008000;
605pub const PD_ENABLEPRINTTEMPLATEHANDLE: DWORD = 0x00010000;
606pub const PD_ENABLESETUPTEMPLATEHANDLE: DWORD = 0x00020000;
607pub const PD_USEDEVMODECOPIES: DWORD = 0x00040000;
608pub const PD_USEDEVMODECOPIESANDCOLLATE: DWORD = 0x00040000;
609pub const PD_DISABLEPRINTTOFILE: DWORD = 0x00080000;
610pub const PD_HIDEPRINTTOFILE: DWORD = 0x00100000;
611pub const PD_NONETWORKBUTTON: DWORD = 0x00200000;
612pub const PD_CURRENTPAGE: DWORD = 0x00400000;
613pub const PD_NOCURRENTPAGE: DWORD = 0x00800000;
614pub const PD_EXCLUSIONFLAGS: DWORD = 0x01000000;
615pub const PD_USELARGETEMPLATE: DWORD = 0x10000000;
616pub const PD_EXCL_COPIESANDCOLLATE: DWORD = DM_COPIES | DM_COLLATE;
617pub const START_PAGE_GENERAL: DWORD = 0xffffffff;
618pub const PD_RESULT_CANCEL: DWORD = 0;
619pub const PD_RESULT_PRINT: DWORD = 1;
620pub const PD_RESULT_APPLY: DWORD = 2;
621STRUCT!{#[cfg_attr(target_arch = "x86", repr(packed))] struct DEVNAMES {
622    wDriverOffset: WORD,
623    wDeviceOffset: WORD,
624    wOutputOffset: WORD,
625    wDefault: WORD,
626}}
627pub type LPDEVNAMES = *mut DEVNAMES;
628pub type PCDEVNAMES = *const DEVNAMES;
629pub const DN_DEFAULTPRN: WORD = 0x0001;
630extern "system" {
631    pub fn CommDlgExtendedError() -> DWORD;
632}
633pub const WM_PSD_PAGESETUPDLG: UINT = WM_USER;
634pub const WM_PSD_FULLPAGERECT: UINT = WM_USER + 1;
635pub const WM_PSD_MINMARGINRECT: UINT = WM_USER + 2;
636pub const WM_PSD_MARGINRECT: UINT = WM_USER + 3;
637pub const WM_PSD_GREEKTEXTRECT: UINT = WM_USER + 4;
638pub const WM_PSD_ENVSTAMPRECT: UINT = WM_USER + 5;
639pub const WM_PSD_YAFULLPAGERECT: UINT = WM_USER + 6;
640FN!{stdcall LPPAGEPAINTHOOK(
641    HWND,
642    UINT,
643    WPARAM,
644    LPARAM,
645) -> UINT_PTR}
646FN!{stdcall LPPAGESETUPHOOK(
647    HWND,
648    UINT,
649    WPARAM,
650    LPARAM,
651) -> UINT_PTR}
652STRUCT!{#[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}}
668pub type LPPAGESETUPDLGA = *mut PAGESETUPDLGA;
669STRUCT!{#[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}}
685pub type LPPAGESETUPDLGW = *mut PAGESETUPDLGW;
686extern "system" {
687    pub fn PageSetupDlgA(
688        lppsd: LPPAGESETUPDLGA,
689    ) -> BOOL;
690    pub fn PageSetupDlgW(
691        lppsd: LPPAGESETUPDLGW,
692    ) -> BOOL;
693}
694pub const PSD_DEFAULTMINMARGINS: DWORD = 0x00000000;
695pub const PSD_INWININIINTLMEASURE: DWORD = 0x00000000;
696pub const PSD_MINMARGINS: DWORD = 0x00000001;
697pub const PSD_MARGINS: DWORD = 0x00000002;
698pub const PSD_INTHOUSANDTHSOFINCHES: DWORD = 0x00000004;
699pub const PSD_INHUNDREDTHSOFMILLIMETERS: DWORD = 0x00000008;
700pub const PSD_DISABLEMARGINS: DWORD = 0x00000010;
701pub const PSD_DISABLEPRINTER: DWORD = 0x00000020;
702pub const PSD_NOWARNING: DWORD = 0x00000080;
703pub const PSD_DISABLEORIENTATION: DWORD = 0x00000100;
704pub const PSD_RETURNDEFAULT: DWORD = 0x00000400;
705pub const PSD_DISABLEPAPER: DWORD = 0x00000200;
706pub const PSD_SHOWHELP: DWORD = 0x00000800;
707pub const PSD_ENABLEPAGESETUPHOOK: DWORD = 0x00002000;
708pub const PSD_ENABLEPAGESETUPTEMPLATE: DWORD = 0x00008000;
709pub const PSD_ENABLEPAGESETUPTEMPLATEHANDLE: DWORD = 0x00020000;
710pub const PSD_ENABLEPAGEPAINTHOOK: DWORD = 0x00040000;
711pub const PSD_DISABLEPAGEPAINTING: DWORD = 0x00080000;
712pub const PSD_NONETWORKBUTTON: DWORD = 0x00200000;