1 // Copyright © 2015, skdltmxn
2 // Licensed under the MIT License <LICENSE.md>
3 //! 32-Bit Common Dialog APIs
4 pub type LPOFNHOOKPROC = Option<unsafe extern "system" fn(
5     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
6 ) -> ::UINT_PTR>;
7 STRUCT!{nodebug struct OPENFILENAME_NT4A {
8     lStructSize: ::DWORD,
9     hwndOwner: ::HWND,
10     hInstance: ::HINSTANCE,
11     lpstrFilter: ::LPCSTR,
12     lpstrCustomFilter: ::LPSTR,
13     nMaxCustFilter: ::DWORD,
14     nFilterIndex: ::DWORD,
15     lpstrFile: ::LPSTR,
16     nMaxFile: ::DWORD,
17     lpstrFileTitle: ::LPSTR,
18     nMaxFileTitle: ::DWORD,
19     lpstrInitialDir: ::LPCSTR,
20     lpstrTitle: ::LPCSTR,
21     Flags: ::DWORD,
22     nFileOffset: ::WORD,
23     nFileExtension: ::WORD,
24     lpstrDefExt: ::LPCSTR,
25     lCustData: ::LPARAM,
26     lpfnHook: LPOFNHOOKPROC,
27     lpTemplateName: ::LPCSTR,
28 }}
29 pub type LPOPENFILENAME_NT4A = *mut OPENFILENAME_NT4A;
30 STRUCT!{nodebug struct OPENFILENAME_NT4W {
31     lStructSize: ::DWORD,
32     hwndOwner: ::HWND,
33     hInstance: ::HINSTANCE,
34     lpstrFilter: ::LPCWSTR,
35     lpstrCustomFilter: ::LPWSTR,
36     nMaxCustFilter: ::DWORD,
37     nFilterIndex: ::DWORD,
38     lpstrFile: ::LPWSTR,
39     nMaxFile: ::DWORD,
40     lpstrFileTitle: ::LPWSTR,
41     nMaxFileTitle: ::DWORD,
42     lpstrInitialDir: ::LPCWSTR,
43     lpstrTitle: ::LPCWSTR,
44     Flags: ::DWORD,
45     nFileOffset: ::WORD,
46     nFileExtension: ::WORD,
47     lpstrDefExt: ::LPCWSTR,
48     lCustData: ::LPARAM,
49     lpfnHook: LPOFNHOOKPROC,
50     lpTemplateName: ::LPCWSTR,
51 }}
52 pub type LPOPENFILENAME_NT4W = *mut OPENFILENAME_NT4W;
53 STRUCT!{nodebug struct OPENFILENAMEA {
54     lStructSize: ::DWORD,
55     hwndOwner: ::HWND,
56     hInstance: ::HINSTANCE,
57     lpstrFilter: ::LPCSTR,
58     lpstrCustomFilter: ::LPSTR,
59     nMaxCustFilter: ::DWORD,
60     nFilterIndex: ::DWORD,
61     lpstrFile: ::LPSTR,
62     nMaxFile: ::DWORD,
63     lpstrFileTitle: ::LPSTR,
64     nMaxFileTitle: ::DWORD,
65     lpstrInitialDir: ::LPCSTR,
66     lpstrTitle: ::LPCSTR,
67     Flags: ::DWORD,
68     nFileOffset: ::WORD,
69     nFileExtension: ::WORD,
70     lpstrDefExt: ::LPCSTR,
71     lCustData: ::LPARAM,
72     lpfnHook: LPOFNHOOKPROC,
73     lpTemplateName: ::LPCSTR,
74     pvReserved: *mut ::c_void,
75     dwReserved: ::DWORD,
76     FlagsEx: ::DWORD,
77 }}
78 pub type LPOPENFILENAMEA = *mut OPENFILENAMEA;
79 STRUCT!{nodebug struct OPENFILENAMEW {
80     lStructSize: ::DWORD,
81     hwndOwner: ::HWND,
82     hInstance: ::HINSTANCE,
83     lpstrFilter: ::LPCWSTR,
84     lpstrCustomFilter: ::LPWSTR,
85     nMaxCustFilter: ::DWORD,
86     nFilterIndex: ::DWORD,
87     lpstrFile: ::LPWSTR,
88     nMaxFile: ::DWORD,
89     lpstrFileTitle: ::LPWSTR,
90     nMaxFileTitle: ::DWORD,
91     lpstrInitialDir: ::LPCWSTR,
92     lpstrTitle: ::LPCWSTR,
93     Flags: ::DWORD,
94     nFileOffset: ::WORD,
95     nFileExtension: ::WORD,
96     lpstrDefExt: ::LPCWSTR,
97     lCustData: ::LPARAM,
98     lpfnHook: LPOFNHOOKPROC,
99     lpTemplateName: ::LPCWSTR,
100     pvReserved: *mut ::c_void,
101     dwReserved: ::DWORD,
102     FlagsEx: ::DWORD,
103 }}
104 pub type LPOPENFILENAMEW = *mut OPENFILENAMEW;
105 pub const OFN_READONLY: ::DWORD = 0x00000001;
106 pub const OFN_OVERWRITEPROMPT: ::DWORD = 0x00000002;
107 pub const OFN_HIDEREADONLY: ::DWORD = 0x00000004;
108 pub const OFN_NOCHANGEDIR: ::DWORD = 0x00000008;
109 pub const OFN_SHOWHELP: ::DWORD = 0x00000010;
110 pub const OFN_ENABLEHOOK: ::DWORD = 0x00000020;
111 pub const OFN_ENABLETEMPLATE: ::DWORD = 0x00000040;
112 pub const OFN_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000080;
113 pub const OFN_NOVALIDATE: ::DWORD = 0x00000100;
114 pub const OFN_ALLOWMULTISELECT: ::DWORD = 0x00000200;
115 pub const OFN_EXTENSIONDIFFERENT: ::DWORD = 0x00000400;
116 pub const OFN_PATHMUSTEXIST: ::DWORD = 0x00000800;
117 pub const OFN_FILEMUSTEXIST: ::DWORD = 0x00001000;
118 pub const OFN_CREATEPROMPT: ::DWORD = 0x00002000;
119 pub const OFN_SHAREAWARE: ::DWORD = 0x00004000;
120 pub const OFN_NOREADONLYRETURN: ::DWORD = 0x00008000;
121 pub const OFN_NOTESTFILECREATE: ::DWORD = 0x00010000;
122 pub const OFN_NONETWORKBUTTON: ::DWORD = 0x00020000;
123 pub const OFN_NOLONGNAMES: ::DWORD = 0x00040000;
124 pub const OFN_EXPLORER: ::DWORD = 0x00080000;
125 pub const OFN_NODEREFERENCELINKS: ::DWORD = 0x00100000;
126 pub const OFN_LONGNAMES: ::DWORD = 0x00200000;
127 pub const OFN_ENABLEINCLUDENOTIFY: ::DWORD = 0x00400000;
128 pub const OFN_ENABLESIZING: ::DWORD = 0x00800000;
129 pub const OFN_DONTADDTORECENT: ::DWORD = 0x02000000;
130 pub const OFN_FORCESHOWHIDDEN: ::DWORD = 0x10000000;
131 pub const OFN_EX_NOPLACESBAR: ::DWORD = 0x00000001;
132 pub const OFN_SHAREFALLTHROUGH: ::UINT_PTR = 2;
133 pub const OFN_SHARENOWARN: ::UINT_PTR = 1;
134 pub const OFN_SHAREWARN: ::UINT_PTR = 0;
135 pub type LPCCHOOKPROC = Option<unsafe extern "system" fn(
136     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
137 ) -> ::UINT_PTR>;
138 STRUCT!{struct OFNOTIFYA {
139     hdr: ::NMHDR,
140     lpOFN: LPOPENFILENAMEA,
141     pszFile: ::LPSTR,
142 }}
143 pub type LPOFNOTIFYA = *mut OFNOTIFYA;
144 STRUCT!{struct OFNOTIFYW {
145     hdr: ::NMHDR,
146     lpOFN: LPOPENFILENAMEW,
147     pszFile: ::LPWSTR,
148 }}
149 pub type LPOFNOTIFYW = *mut OFNOTIFYW;
150 STRUCT!{struct OFNOTIFYEXA {
151     hdr: ::NMHDR,
152     lpOFN: LPOPENFILENAMEA,
153     psf: ::LPVOID,
154     pidl: ::LPVOID,
155 }}
156 pub type LPOFNOTIFYEXA = *mut OFNOTIFYEXA;
157 STRUCT!{struct OFNOTIFYEXW {
158     hdr: ::NMHDR,
159     lpOFN: LPOPENFILENAMEW,
160     psf: ::LPVOID,
161     pidl: ::LPVOID,
162 }}
163 pub type LPOFNOTIFYEXW = *mut OFNOTIFYEXW;
164 pub const CDN_FIRST: ::UINT = -601i32 as ::UINT;
165 pub const CDN_LAST: ::UINT = -699i32 as ::UINT;
166 pub const CDN_INITDONE: ::UINT = CDN_FIRST - 0x0000;
167 pub const CDN_SELCHANGE: ::UINT = CDN_FIRST - 0x0001;
168 pub const CDN_FOLDERCHANGE: ::UINT = CDN_FIRST - 0x0002;
169 pub const CDN_SHAREVIOLATION: ::UINT = CDN_FIRST - 0x0003;
170 pub const CDN_HELP: ::UINT = CDN_FIRST - 0x0004;
171 pub const CDN_FILEOK: ::UINT = CDN_FIRST - 0x0005;
172 pub const CDN_TYPECHANGE: ::UINT = CDN_FIRST - 0x0006;
173 pub const CDN_INCLUDEITEM: ::UINT = CDN_FIRST - 0x0007;
174 pub const CDM_FIRST: ::UINT = ::WM_USER + 100;
175 pub const CDM_LAST: ::UINT = ::WM_USER + 200;
176 pub const CDM_GETSPEC: ::UINT = CDM_FIRST + 0x0000;
177 pub const CDM_GETFILEPATH: ::UINT = CDM_FIRST + 0x0001;
178 pub const CDM_GETFOLDERPATH: ::UINT = CDM_FIRST + 0x0002;
179 pub const CDM_GETFOLDERIDLIST: ::UINT = CDM_FIRST + 0x0003;
180 pub const CDM_SETCONTROLTEXT: ::UINT = CDM_FIRST + 0x0004;
181 pub const CDM_HIDECONTROL: ::UINT = CDM_FIRST + 0x0005;
182 pub const CDM_SETDEFEXT: ::UINT = CDM_FIRST + 0x0006;
183 STRUCT!{nodebug struct CHOOSECOLORA {
184     lStructSize: ::DWORD,
185     hwndOwner: ::HWND,
186     hInstance: ::HWND,
187     rgbResult: ::COLORREF,
188     lpCustColors: *mut ::COLORREF,
189     Flags: ::DWORD,
190     lCustData: ::LPARAM,
191     lpfnHook: LPCCHOOKPROC,
192     lpTemplateName: ::LPCSTR,
193 }}
194 pub type LPCHOOSECOLORA = *mut CHOOSECOLORA;
195 STRUCT!{nodebug struct CHOOSECOLORW {
196     lStructSize: ::DWORD,
197     hwndOwner: ::HWND,
198     hInstance: ::HWND,
199     rgbResult: ::COLORREF,
200     lpCustColors: *mut ::COLORREF,
201     Flags: ::DWORD,
202     lCustData: ::LPARAM,
203     lpfnHook: LPCCHOOKPROC,
204     lpTemplateName: ::LPCWSTR,
205 }}
206 pub type LPCHOOSECOLORW = *mut CHOOSECOLORW;
207 pub const CC_RGBINIT: ::DWORD = 0x00000001;
208 pub const CC_FULLOPEN: ::DWORD = 0x00000002;
209 pub const CC_PREVENTFULLOPEN: ::DWORD = 0x00000004;
210 pub const CC_SHOWHELP: ::DWORD = 0x00000008;
211 pub const CC_ENABLEHOOK: ::DWORD = 0x00000010;
212 pub const CC_ENABLETEMPLATE: ::DWORD = 0x00000020;
213 pub const CC_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000040;
214 pub const CC_SOLIDCOLOR: ::DWORD = 0x00000080;
215 pub const CC_ANYCOLOR: ::DWORD = 0x00000100;
216 pub type LPFRHOOKPROC = Option<unsafe extern "system" fn(
217     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
218 ) -> ::UINT_PTR>;
219 STRUCT!{nodebug struct FINDREPLACEA {
220     lStructSize: ::DWORD,
221     hwndOwner: ::HWND,
222     hInstance: ::HINSTANCE,
223     Flags: ::DWORD,
224     lpstrFindWhat: ::LPSTR,
225     lpstrReplaceWith: ::LPSTR,
226     wFindWhatLen: ::WORD,
227     wReplaceWithLen: ::WORD,
228     lCustData: ::LPARAM,
229     lpfnHook: LPFRHOOKPROC,
230     lpTemplateName: ::LPCSTR,
231 }}
232 pub type LPFINDREPLACEA = *mut FINDREPLACEA;
233 STRUCT!{nodebug struct FINDREPLACEW {
234     lStructSize: ::DWORD,
235     hwndOwner: ::HWND,
236     hInstance: ::HINSTANCE,
237     Flags: ::DWORD,
238     lpstrFindWhat: ::LPWSTR,
239     lpstrReplaceWith: ::LPWSTR,
240     wFindWhatLen: ::WORD,
241     wReplaceWithLen: ::WORD,
242     lCustData: ::LPARAM,
243     lpfnHook: LPFRHOOKPROC,
244     lpTemplateName: ::LPCWSTR,
245 }}
246 pub type LPFINDREPLACEW = *mut FINDREPLACEW;
247 pub const FR_DOWN: ::DWORD = 0x00000001;
248 pub const FR_WHOLEWORD: ::DWORD = 0x00000002;
249 pub const FR_MATCHCASE: ::DWORD = 0x00000004;
250 pub const FR_FINDNEXT: ::DWORD = 0x00000008;
251 pub const FR_REPLACE: ::DWORD = 0x00000010;
252 pub const FR_REPLACEALL: ::DWORD = 0x00000020;
253 pub const FR_DIALOGTERM: ::DWORD = 0x00000040;
254 pub const FR_SHOWHELP: ::DWORD = 0x00000080;
255 pub const FR_ENABLEHOOK: ::DWORD = 0x00000100;
256 pub const FR_ENABLETEMPLATE: ::DWORD = 0x00000200;
257 pub const FR_NOUPDOWN: ::DWORD = 0x00000400;
258 pub const FR_NOMATCHCASE: ::DWORD = 0x00000800;
259 pub const FR_NOWHOLEWORD: ::DWORD = 0x00001000;
260 pub const FR_ENABLETEMPLATEHANDLE: ::DWORD = 0x00002000;
261 pub const FR_HIDEUPDOWN: ::DWORD = 0x00004000;
262 pub const FR_HIDEMATCHCASE: ::DWORD = 0x00008000;
263 pub const FR_HIDEWHOLEWORD: ::DWORD = 0x00010000;
264 pub const FR_RAW: ::DWORD = 0x00020000;
265 pub const FR_MATCHDIAC: ::DWORD = 0x20000000;
266 pub const FR_MATCHKASHIDA: ::DWORD = 0x40000000;
267 pub const FR_MATCHALEFHAMZA: ::DWORD = 0x80000000;
268 pub type LPCFHOOKPROC = Option<unsafe extern "system" fn(
269     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
270 ) -> ::UINT_PTR>;
271 STRUCT!{nodebug struct CHOOSEFONTA {
272     lStructSize: ::DWORD,
273     hwndOwner: ::HWND,
274     hDC: ::HDC,
275     lpLogFont: ::LPLOGFONTA,
276     iPointSize: ::INT,
277     Flags: ::DWORD,
278     rgbColors: ::COLORREF,
279     lCustData: ::LPARAM,
280     lpfnHook: LPCFHOOKPROC,
281     lpTemplateName: ::LPCSTR,
282     hInstance: ::HINSTANCE,
283     lpszStyle: ::LPSTR,
284     nFontType: ::WORD,
285     ___MISSING_ALIGNMENT__: ::WORD,
286     nSizeMin: ::INT,
287     nSizeMax: ::INT,
288 }}
289 pub type LPCHOOSEFONTA = *mut CHOOSEFONTA;
290 STRUCT!{nodebug struct CHOOSEFONTW {
291     lStructSize: ::DWORD,
292     hwndOwner: ::HWND,
293     hDC: ::HDC,
294     lpLogFont: ::LPLOGFONTW,
295     iPointSize: ::INT,
296     Flags: ::DWORD,
297     rgbColors: ::COLORREF,
298     lCustData: ::LPARAM,
299     lpfnHook: LPCFHOOKPROC,
300     lpTemplateName: ::LPCWSTR,
301     hInstance: ::HINSTANCE,
302     lpszStyle: ::LPWSTR,
303     nFontType: ::WORD,
304     ___MISSING_ALIGNMENT__: ::WORD,
305     nSizeMin: ::INT,
306     nSizeMax: ::INT,
307 }}
308 pub type LPCHOOSEFONTW = *mut CHOOSEFONTW;
309 pub const CF_SCREENFONTS: ::DWORD = 0x00000001;
310 pub const CF_PRINTERFONTS: ::DWORD = 0x00000002;
311 pub const CF_BOTH: ::DWORD = CF_SCREENFONTS | CF_PRINTERFONTS;
312 pub const CF_SHOWHELP: ::DWORD = 0x00000004;
313 pub const CF_ENABLEHOOK: ::DWORD = 0x00000008;
314 pub const CF_ENABLETEMPLATE: ::DWORD = 0x00000010;
315 pub const CF_ENABLETEMPLATEHANDLE: ::DWORD = 0x00000020;
316 pub const CF_INITTOLOGFONTSTRUCT: ::DWORD = 0x00000040;
317 pub const CF_USESTYLE: ::DWORD = 0x00000080;
318 pub const CF_EFFECTS: ::DWORD = 0x00000100;
319 pub const CF_APPLY: ::DWORD = 0x00000200;
320 pub const CF_ANSIONLY: ::DWORD = 0x00000400;
321 pub const CF_SCRIPTSONLY: ::DWORD = CF_ANSIONLY;
322 pub const CF_NOVECTORFONTS: ::DWORD = 0x00000800;
323 pub const CF_NOOEMFONTS: ::DWORD = CF_NOVECTORFONTS;
324 pub const CF_NOSIMULATIONS: ::DWORD = 0x00001000;
325 pub const CF_LIMITSIZE: ::DWORD = 0x00002000;
326 pub const CF_FIXEDPITCHONLY: ::DWORD = 0x00004000;
327 pub const CF_WYSIWYG: ::DWORD = 0x00008000;
328 pub const CF_FORCEFONTEXIST: ::DWORD = 0x00010000;
329 pub const CF_SCALABLEONLY: ::DWORD = 0x00020000;
330 pub const CF_TTONLY: ::DWORD = 0x00040000;
331 pub const CF_NOFACESEL: ::DWORD = 0x00080000;
332 pub const CF_NOSTYLESEL: ::DWORD = 0x00100000;
333 pub const CF_NOSIZESEL: ::DWORD = 0x00200000;
334 pub const CF_SELECTSCRIPT: ::DWORD = 0x00400000;
335 pub const CF_NOSCRIPTSEL: ::DWORD = 0x00800000;
336 pub const CF_NOVERTFONTS: ::DWORD = 0x01000000;
337 pub const CF_INACTIVEFONTS: ::DWORD = 0x02000000;
338 pub const SIMULATED_FONTTYPE: ::WORD = 0x8000;
339 pub const PRINTER_FONTTYPE: ::WORD = 0x4000;
340 pub const SCREEN_FONTTYPE: ::WORD = 0x2000;
341 pub const BOLD_FONTTYPE: ::WORD = 0x0100;
342 pub const ITALIC_FONTTYPE: ::WORD = 0x0200;
343 pub const REGULAR_FONTTYPE: ::WORD = 0x0400;
344 pub const PS_OPENTYPE_FONTTYPE: ::DWORD = 0x10000;
345 pub const TT_OPENTYPE_FONTTYPE: ::DWORD = 0x20000;
346 pub const TYPE1_FONTTYPE: ::DWORD = 0x40000;
347 pub const SYMBOL_FONTTYPE: ::DWORD = 0x80000;
348 pub const WM_CHOOSEFONT_GETLOGFONT: ::UINT = ::WM_USER + 1;
349 pub const WM_CHOOSEFONT_SETLOGFONT: ::UINT = ::WM_USER + 101;
350 pub const WM_CHOOSEFONT_SETFLAGS: ::UINT = ::WM_USER + 102;
351 pub const CD_LBSELNOITEMS: ::WORD = -1i16 as ::WORD;
352 pub const CD_LBSELCHANGE: ::WORD = 0;
353 pub const CD_LBSELSUB: ::WORD = 1;
354 pub const CD_LBSELADD: ::WORD = 2;
355 pub type LPPRINTHOOKPROC = Option<unsafe extern "system" fn(
356     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
357 ) -> ::UINT_PTR>;
358 pub type LPSETUPHOOKPROC = Option<unsafe extern "system" fn(
359     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
360 ) -> ::UINT_PTR>;
361 STRUCT!{nodebug struct PRINTDLGA {
362     lStructSize: ::DWORD,
363     hwndOwner: ::HWND,
364     hDevMode: ::HGLOBAL,
365     hDevNames: ::HGLOBAL,
366     hDC: ::HDC,
367     Flags: ::DWORD,
368     nFromPage: ::WORD,
369     nToPage: ::WORD,
370     nMinPage: ::WORD,
371     nMaxPage: ::WORD,
372     nCopies: ::WORD,
373     hInstance: ::HINSTANCE,
374     lCustData: ::LPARAM,
375     lpfnPrintHook: LPPRINTHOOKPROC,
376     lpfnSetupHook: LPSETUPHOOKPROC,
377     lpPrintTemplateName: ::LPCSTR,
378     lpSetupTemplateName: ::LPCSTR,
379     hPrintTemplate: ::HGLOBAL,
380     hSetupTemplate: ::HGLOBAL,
381 }}
382 pub type LPPRINTDLGA = *mut PRINTDLGA;
383 STRUCT!{nodebug struct PRINTDLGW {
384     lStructSize: ::DWORD,
385     hwndOwner: ::HWND,
386     hDevMode: ::HGLOBAL,
387     hDevNames: ::HGLOBAL,
388     hDC: ::HDC,
389     Flags: ::DWORD,
390     nFromPage: ::WORD,
391     nToPage: ::WORD,
392     nMinPage: ::WORD,
393     nMaxPage: ::WORD,
394     nCopies: ::WORD,
395     hInstance: ::HINSTANCE,
396     lCustData: ::LPARAM,
397     lpfnPrintHook: LPPRINTHOOKPROC,
398     lpfnSetupHook: LPSETUPHOOKPROC,
399     lpPrintTemplateName: ::LPCWSTR,
400     lpSetupTemplateName: ::LPCWSTR,
401     hPrintTemplate: ::HGLOBAL,
402     hSetupTemplate: ::HGLOBAL,
403 }}
404 pub type LPPRINTDLGW = *mut PRINTDLGW;
405 RIDL!(
406 interface IPrintDialogCallback(IPrintDialogCallbackVtbl) : IUnknown(IUnknownVtbl) {
407     fn InitDone(&mut self) -> ::HRESULT,
408     fn SelectionChange(&mut self) -> ::HRESULT,
409     fn HandleMessage(
410         &mut self, hDlg: ::HWND, uMsg: ::UINT, wParam: ::WPARAM, lParam: ::LPARAM,
411         pResult: *mut ::LRESULT
412     ) -> ::HRESULT
413 }
414 );
415 RIDL!(
416 interface IPrintDialogServices(IPrintDialogServicesVtbl) : IUnknown(IUnknownVtbl) {
417     fn GetCurrentDevMode(&mut self, pDevMode: ::LPDEVMODEW, pcbSize: *mut ::UINT) -> ::HRESULT,
418     fn GetCurrentPrinterName(&mut self, pPrinterName: ::LPWSTR, pcchSize: *mut ::UINT) -> ::HRESULT,
419     fn GetCurrentPortName(&mut self, pPortName: ::LPWSTR, pcchSize: *mut ::UINT) -> ::HRESULT
420 }
421 );
422 STRUCT!{struct PRINTPAGERANGE {
423     nFromPage: ::DWORD,
424     nToPage: ::DWORD,
425 }}
426 pub type LPPRINTPAGERANGE = *mut PRINTPAGERANGE;
427 pub type PCPRINTPAGERANGE = *const PRINTPAGERANGE;
428 STRUCT!{struct PRINTDLGEXA {
429     lStructSize: ::DWORD,
430     hwndOwner: ::HWND,
431     hDevMode: ::HGLOBAL,
432     hDevNames: ::HGLOBAL,
433     hDC: ::HDC,
434     Flags: ::DWORD,
435     Flags2: ::DWORD,
436     ExclusionFlags: ::DWORD,
437     nPageRanges: ::DWORD,
438     nMaxPageRanges: ::DWORD,
439     lpPageRanges: LPPRINTPAGERANGE,
440     nMinPage: ::DWORD,
441     nMaxPage: ::DWORD,
442     nCopies: ::DWORD,
443     hInstance: ::HINSTANCE,
444     lpPrintTemplateName: ::LPCSTR,
445     lpCallback: ::LPUNKNOWN,
446     nPropertyPages: ::DWORD,
447     lphPropertyPages: *mut ::HPROPSHEETPAGE,
448     nStartPage: ::DWORD,
449     dwResultAction: ::DWORD,
450 }}
451 pub type LPPRINTDLGEXA = *mut PRINTDLGEXA;
452 STRUCT!{struct PRINTDLGEXW {
453     lStructSize: ::DWORD,
454     hwndOwner: ::HWND,
455     hDevMode: ::HGLOBAL,
456     hDevNames: ::HGLOBAL,
457     hDC: ::HDC,
458     Flags: ::DWORD,
459     Flags2: ::DWORD,
460     ExclusionFlags: ::DWORD,
461     nPageRanges: ::DWORD,
462     nMaxPageRanges: ::DWORD,
463     lpPageRanges: LPPRINTPAGERANGE,
464     nMinPage: ::DWORD,
465     nMaxPage: ::DWORD,
466     nCopies: ::DWORD,
467     hInstance: ::HINSTANCE,
468     lpPrintTemplateName: ::LPCWSTR,
469     lpCallback: ::LPUNKNOWN,
470     nPropertyPages: ::DWORD,
471     lphPropertyPages: *mut ::HPROPSHEETPAGE,
472     nStartPage: ::DWORD,
473     dwResultAction: ::DWORD,
474 }}
475 pub type LPPRINTDLGEXW = *mut PRINTDLGEXW;
476 pub const PD_ALLPAGES: ::DWORD = 0x00000000;
477 pub const PD_SELECTION: ::DWORD = 0x00000001;
478 pub const PD_PAGENUMS: ::DWORD = 0x00000002;
479 pub const PD_NOSELECTION: ::DWORD = 0x00000004;
480 pub const PD_NOPAGENUMS: ::DWORD = 0x00000008;
481 pub const PD_COLLATE: ::DWORD = 0x00000010;
482 pub const PD_PRINTTOFILE: ::DWORD = 0x00000020;
483 pub const PD_PRINTSETUP: ::DWORD = 0x00000040;
484 pub const PD_NOWARNING: ::DWORD = 0x00000080;
485 pub const PD_RETURNDC: ::DWORD = 0x00000100;
486 pub const PD_RETURNIC: ::DWORD = 0x00000200;
487 pub const PD_RETURNDEFAULT: ::DWORD = 0x00000400;
488 pub const PD_SHOWHELP: ::DWORD = 0x00000800;
489 pub const PD_ENABLEPRINTHOOK: ::DWORD = 0x00001000;
490 pub const PD_ENABLESETUPHOOK: ::DWORD = 0x00002000;
491 pub const PD_ENABLEPRINTTEMPLATE: ::DWORD = 0x00004000;
492 pub const PD_ENABLESETUPTEMPLATE: ::DWORD = 0x00008000;
493 pub const PD_ENABLEPRINTTEMPLATEHANDLE: ::DWORD = 0x00010000;
494 pub const PD_ENABLESETUPTEMPLATEHANDLE: ::DWORD = 0x00020000;
495 pub const PD_USEDEVMODECOPIES: ::DWORD = 0x00040000;
496 pub const PD_USEDEVMODECOPIESANDCOLLATE: ::DWORD = 0x00040000;
497 pub const PD_DISABLEPRINTTOFILE: ::DWORD = 0x00080000;
498 pub const PD_HIDEPRINTTOFILE: ::DWORD = 0x00100000;
499 pub const PD_NONETWORKBUTTON: ::DWORD = 0x00200000;
500 pub const PD_CURRENTPAGE: ::DWORD = 0x00400000;
501 pub const PD_NOCURRENTPAGE: ::DWORD = 0x00800000;
502 pub const PD_EXCLUSIONFLAGS: ::DWORD = 0x01000000;
503 pub const PD_USELARGETEMPLATE: ::DWORD = 0x10000000;
504 pub const PD_EXCL_COPIESANDCOLLATE: ::DWORD = ::DM_COPIES | ::DM_COLLATE;
505 pub const START_PAGE_GENERAL: ::DWORD = 0xffffffff;
506 pub const PD_RESULT_CANCEL: ::DWORD = 0;
507 pub const PD_RESULT_PRINT: ::DWORD = 1;
508 pub const PD_RESULT_APPLY: ::DWORD = 2;
509 STRUCT!{struct DEVNAMES {
510     wDriverOffset: ::WORD,
511     wDeviceOffset: ::WORD,
512     wOutputOffset: ::WORD,
513     wDefault: ::WORD,
514 }}
515 pub type LPDEVNAMES = *mut DEVNAMES;
516 pub type PCDEVNAMES = *const DEVNAMES;
517 pub const DN_DEFAULTPRN: ::WORD = 0x0001;
518 pub const WM_PSD_PAGESETUPDLG: ::UINT = ::WM_USER;
519 pub const WM_PSD_FULLPAGERECT: ::UINT = ::WM_USER + 1;
520 pub const WM_PSD_MINMARGINRECT: ::UINT = ::WM_USER + 2;
521 pub const WM_PSD_MARGINRECT: ::UINT = ::WM_USER + 3;
522 pub const WM_PSD_GREEKTEXTRECT: ::UINT = ::WM_USER + 4;
523 pub const WM_PSD_ENVSTAMPRECT: ::UINT = ::WM_USER + 5;
524 pub const WM_PSD_YAFULLPAGERECT: ::UINT = ::WM_USER + 6;
525 pub type LPPAGEPAINTHOOK = Option<unsafe extern "system" fn(
526     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
527 ) -> ::UINT_PTR>;
528 pub type LPPAGESETUPHOOK = Option<unsafe extern "system" fn(
529     ::HWND, ::UINT, ::WPARAM, ::LPARAM,
530 ) -> ::UINT_PTR>;
531 STRUCT!{nodebug struct PAGESETUPDLGA {
532     lStructSize: ::DWORD,
533     hwndOwner: ::HWND,
534     hDevMode: ::HGLOBAL,
535     hDevNames: ::HGLOBAL,
536     Flags: ::DWORD,
537     ptPaperSize: ::POINT,
538     rtMinMargin: ::RECT,
539     rtMargin: ::RECT,
540     hInstance: ::HINSTANCE,
541     lCustData: ::LPARAM,
542     lpfnPageSetupHook: LPPAGESETUPHOOK,
543     lpfnPagePaintHook: LPPAGEPAINTHOOK,
544     lpPageSetupTemplateName: ::LPCSTR,
545     hPageSetupTemplate: ::HGLOBAL,
546 }}
547 pub type LPPAGESETUPDLGA = *mut PAGESETUPDLGA;
548 STRUCT!{nodebug struct PAGESETUPDLGW {
549     lStructSize: ::DWORD,
550     hwndOwner: ::HWND,
551     hDevMode: ::HGLOBAL,
552     hDevNames: ::HGLOBAL,
553     Flags: ::DWORD,
554     ptPaperSize: ::POINT,
555     rtMinMargin: ::RECT,
556     rtMargin: ::RECT,
557     hInstance: ::HINSTANCE,
558     lCustData: ::LPARAM,
559     lpfnPageSetupHook: LPPAGESETUPHOOK,
560     lpfnPagePaintHook: LPPAGEPAINTHOOK,
561     lpPageSetupTemplateName: ::LPCWSTR,
562     hPageSetupTemplate: ::HGLOBAL,
563 }}
564 pub type LPPAGESETUPDLGW = *mut PAGESETUPDLGW;
565 pub const PSD_DEFAULTMINMARGINS: ::DWORD = 0x00000000;
566 pub const PSD_INWININIINTLMEASURE: ::DWORD = 0x00000000;
567 pub const PSD_MINMARGINS: ::DWORD = 0x00000001;
568 pub const PSD_MARGINS: ::DWORD = 0x00000002;
569 pub const PSD_INTHOUSANDTHSOFINCHES: ::DWORD = 0x00000004;
570 pub const PSD_INHUNDREDTHSOFMILLIMETERS: ::DWORD = 0x00000008;
571 pub const PSD_DISABLEMARGINS: ::DWORD = 0x00000010;
572 pub const PSD_DISABLEPRINTER: ::DWORD = 0x00000020;
573 pub const PSD_NOWARNING: ::DWORD = 0x00000080;
574 pub const PSD_DISABLEORIENTATION: ::DWORD = 0x00000100;
575 pub const PSD_RETURNDEFAULT: ::DWORD = 0x00000400;
576 pub const PSD_DISABLEPAPER: ::DWORD = 0x00000200;
577 pub const PSD_SHOWHELP: ::DWORD = 0x00000800;
578 pub const PSD_ENABLEPAGESETUPHOOK: ::DWORD = 0x00002000;
579 pub const PSD_ENABLEPAGESETUPTEMPLATE: ::DWORD = 0x00008000;
580 pub const PSD_ENABLEPAGESETUPTEMPLATEHANDLE: ::DWORD = 0x00020000;
581 pub const PSD_ENABLEPAGEPAINTHOOK: ::DWORD = 0x00040000;
582 pub const PSD_DISABLEPAGEPAINTING: ::DWORD = 0x00080000;
583 pub const PSD_NONETWORKBUTTON: ::DWORD = 0x00200000;
584