"Fossies" - the Fresh Open Source Software Archive

Member "dmd2/src/druntime/src/core/sys/windows/commdlg.d" (20 Nov 2020, 22427 Bytes) of package /linux/misc/dmd.2.094.2.linux.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) D source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /**
    2  * Windows API header module
    3  *
    4  * Translated from MinGW API for MS-Windows 3.12
    5  *
    6  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
    7  * Source: $(DRUNTIMESRC src/core/sys/windows/_commdlg.d)
    8  */
    9 module core.sys.windows.commdlg;
   10 version (Windows):
   11 @system:
   12 
   13 version (ANSI) {} else version = Unicode;
   14 pragma(lib, "comdlg32");
   15 
   16 private import core.sys.windows.w32api;
   17 import core.sys.windows.windef, core.sys.windows.winuser;
   18 import core.sys.windows.wingdi; // for LPLOGFONTA
   19 
   20 const TCHAR[]
   21     LBSELCHSTRING = "commdlg_LBSelChangedNotify",
   22     SHAREVISTRING = "commdlg_ShareViolation",
   23     FILEOKSTRING  = "commdlg_FileNameOK",
   24     COLOROKSTRING = "commdlg_ColorOK",
   25     SETRGBSTRING  = "commdlg_SetRGBColor",
   26     HELPMSGSTRING = "commdlg_help",
   27     FINDMSGSTRING = "commdlg_FindReplace";
   28 
   29 enum : UINT {
   30     CDN_FIRST          = -601, // also in commctrl.h
   31     CDN_LAST           = -699,
   32     CDN_INITDONE       = CDN_FIRST,
   33     CDN_SELCHANGE      = CDN_FIRST - 1,
   34     CDN_FOLDERCHANGE   = CDN_FIRST - 2,
   35     CDN_SHAREVIOLATION = CDN_FIRST - 3,
   36     CDN_HELP           = CDN_FIRST - 4,
   37     CDN_FILEOK         = CDN_FIRST - 5,
   38     CDN_TYPECHANGE     = CDN_FIRST - 6,
   39 }
   40 
   41 //static if (_WIN32_WINNT >= 0x500) {
   42     enum : UINT {
   43         CDN_INCLUDEITEM    = CDN_FIRST - 7,
   44     }
   45 //}
   46 
   47 enum : UINT {
   48     CDM_FIRST           = WM_USER + 100,
   49     CDM_LAST            = WM_USER + 200,
   50     CDM_GETSPEC         = CDM_FIRST,
   51     CDM_GETFILEPATH,
   52     CDM_GETFOLDERPATH,
   53     CDM_GETFOLDERIDLIST,
   54     CDM_SETCONTROLTEXT,
   55     CDM_HIDECONTROL,
   56     CDM_SETDEFEXT    // = CDM_FIRST + 6
   57 }
   58 
   59 // flags for ChooseColor
   60 enum : DWORD {
   61     CC_RGBINIT              = 0x0001,
   62     CC_FULLOPEN             = 0x0002,
   63     CC_PREVENTFULLOPEN      = 0x0004,
   64     CC_SHOWHELP             = 0x0008,
   65     CC_ENABLEHOOK           = 0x0010,
   66     CC_ENABLETEMPLATE       = 0x0020,
   67     CC_ENABLETEMPLATEHANDLE = 0x0040,
   68     CC_SOLIDCOLOR           = 0x0080,
   69     CC_ANYCOLOR             = 0x0100
   70 }
   71 
   72 // flags for ChooseFont
   73 enum : DWORD {
   74     CF_SCREENFONTS          = 0x00000001,
   75     CF_PRINTERFONTS         = 0x00000002,
   76     CF_BOTH                 = 0x00000003,
   77     CF_SHOWHELP             = 0x00000004,
   78     CF_ENABLEHOOK           = 0x00000008,
   79     CF_ENABLETEMPLATE       = 0x00000010,
   80     CF_ENABLETEMPLATEHANDLE = 0x00000020,
   81     CF_INITTOLOGFONTSTRUCT  = 0x00000040,
   82     CF_USESTYLE             = 0x00000080,
   83     CF_EFFECTS              = 0x00000100,
   84     CF_APPLY                = 0x00000200,
   85     CF_ANSIONLY             = 0x00000400,
   86     CF_SCRIPTSONLY          = CF_ANSIONLY,
   87     CF_NOVECTORFONTS        = 0x00000800,
   88     CF_NOOEMFONTS           = 0x00000800,
   89     CF_NOSIMULATIONS        = 0x00001000,
   90     CF_LIMITSIZE            = 0x00002000,
   91     CF_FIXEDPITCHONLY       = 0x00004000,
   92     CF_WYSIWYG              = 0x00008000,
   93     CF_FORCEFONTEXIST       = 0x00010000,
   94     CF_SCALABLEONLY         = 0x00020000,
   95     CF_TTONLY               = 0x00040000,
   96     CF_NOFACESEL            = 0x00080000,
   97     CF_NOSTYLESEL           = 0x00100000,
   98     CF_NOSIZESEL            = 0x00200000,
   99     CF_SELECTSCRIPT         = 0x00400000,
  100     CF_NOSCRIPTSEL          = 0x00800000,
  101     CF_NOVERTFONTS          = 0x01000000
  102 }
  103 
  104 // Font type for ChooseFont
  105 enum : WORD {
  106     BOLD_FONTTYPE      = 0x0100,
  107     ITALIC_FONTTYPE    = 0x0200,
  108     REGULAR_FONTTYPE   = 0x0400,
  109     SCREEN_FONTTYPE    = 0x2000,
  110     PRINTER_FONTTYPE   = 0x4000,
  111     SIMULATED_FONTTYPE = 0x8000
  112 }
  113 
  114 enum : UINT {
  115     WM_CHOOSEFONT_GETLOGFONT = WM_USER +   1,
  116     WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101,
  117     WM_CHOOSEFONT_SETFLAGS   = WM_USER + 102
  118 }
  119 
  120 // flags for OpenFileName
  121 enum : DWORD {
  122     OFN_SHAREWARN            = 0,
  123     OFN_SHARENOWARN          = 0x000001,
  124     OFN_READONLY             = 0x000001,
  125     OFN_SHAREFALLTHROUGH     = 0x000002,
  126     OFN_OVERWRITEPROMPT      = 0x000002,
  127     OFN_HIDEREADONLY         = 0x000004,
  128     OFN_NOCHANGEDIR          = 0x000008,
  129     OFN_SHOWHELP             = 0x000010,
  130     OFN_ENABLEHOOK           = 0x000020,
  131     OFN_ENABLETEMPLATE       = 0x000040,
  132     OFN_ENABLETEMPLATEHANDLE = 0x000080,
  133     OFN_NOVALIDATE           = 0x000100,
  134     OFN_ALLOWMULTISELECT     = 0x000200,
  135     OFN_EXTENSIONDIFFERENT   = 0x000400,
  136     OFN_PATHMUSTEXIST        = 0x000800,
  137     OFN_FILEMUSTEXIST        = 0x001000,
  138     OFN_CREATEPROMPT         = 0x002000,
  139     OFN_SHAREAWARE           = 0x004000,
  140     OFN_NOREADONLYRETURN     = 0x008000,
  141     OFN_NOTESTFILECREATE     = 0x010000,
  142     OFN_NONETWORKBUTTON      = 0x020000,
  143     OFN_NOLONGNAMES          = 0x040000,
  144     OFN_EXPLORER             = 0x080000,
  145     OFN_NODEREFERENCELINKS   = 0x100000,
  146     OFN_LONGNAMES            = 0x200000,
  147     OFN_ENABLESIZING         = 0x800000
  148 }
  149 
  150 enum : DWORD {
  151     FR_DOWN                 = 0x00000001,
  152     FR_WHOLEWORD            = 0x00000002,
  153     FR_MATCHCASE            = 0x00000004,
  154     FR_FINDNEXT             = 0x00000008,
  155     FR_REPLACE              = 0x00000010,
  156     FR_REPLACEALL           = 0x00000020,
  157     FR_DIALOGTERM           = 0x00000040,
  158     FR_SHOWHELP             = 0x00000080,
  159     FR_ENABLEHOOK           = 0x00000100,
  160     FR_ENABLETEMPLATE       = 0x00000200,
  161     FR_NOUPDOWN             = 0x00000400,
  162     FR_NOMATCHCASE          = 0x00000800,
  163     FR_NOWHOLEWORD          = 0x00001000,
  164     FR_ENABLETEMPLATEHANDLE = 0x00002000,
  165     FR_HIDEUPDOWN           = 0x00004000,
  166     FR_HIDEMATCHCASE        = 0x00008000,
  167     FR_HIDEWHOLEWORD        = 0x00010000,
  168     FR_MATCHDIAC            = 0x20000000,
  169     FR_MATCHKASHIDA         = 0x40000000,
  170     FR_MATCHALEFHAMZA       = 0x80000000
  171 }
  172 
  173 enum : DWORD {
  174     PD_ALLPAGES                   = 0,
  175     PD_SELECTION                  = 0x000001,
  176     PD_PAGENUMS                   = 0x000002,
  177     PD_NOSELECTION                = 0x000004,
  178     PD_NOPAGENUMS                 = 0x000008,
  179     PD_COLLATE                    = 0x000010,
  180     PD_PRINTTOFILE                = 0x000020,
  181     PD_PRINTSETUP                 = 0x000040,
  182     PD_NOWARNING                  = 0x000080,
  183     PD_RETURNDC                   = 0x000100,
  184     PD_RETURNIC                   = 0x000200,
  185     PD_RETURNDEFAULT              = 0x000400,
  186     PD_SHOWHELP                   = 0x000800,
  187     PD_ENABLEPRINTHOOK            = 0x001000,
  188     PD_ENABLESETUPHOOK            = 0x002000,
  189     PD_ENABLEPRINTTEMPLATE        = 0x004000,
  190     PD_ENABLESETUPTEMPLATE        = 0x008000,
  191     PD_ENABLEPRINTTEMPLATEHANDLE  = 0x010000,
  192     PD_ENABLESETUPTEMPLATEHANDLE  = 0x020000,
  193     PD_USEDEVMODECOPIES           = 0x040000,
  194     PD_USEDEVMODECOPIESANDCOLLATE = 0x040000,
  195     PD_DISABLEPRINTTOFILE         = 0x080000,
  196     PD_HIDEPRINTTOFILE            = 0x100000,
  197     PD_NONETWORKBUTTON            = 0x200000
  198 }
  199 
  200 //static if (_WIN32_WINNT >= 0x500) {
  201     enum : DWORD {
  202         PD_CURRENTPAGE      = 0x00400000,
  203         PD_NOCURRENTPAGE    = 0x00800000,
  204         PD_EXCLUSIONFLAGS   = 0x01000000,
  205         PD_USELARGETEMPLATE = 0x10000000,
  206     }
  207 
  208     enum : HRESULT {
  209         PD_RESULT_CANCEL,
  210         PD_RESULT_PRINT,
  211         PD_RESULT_APPLY
  212     }
  213 
  214 enum DWORD START_PAGE_GENERAL = 0xFFFFFFFF;
  215 //}
  216 
  217 enum {
  218     PSD_DEFAULTMINMARGINS             = 0,
  219     PSD_INWININIINTLMEASURE           = 0,
  220     PSD_MINMARGINS                    = 0x000001,
  221     PSD_MARGINS                       = 0x000002,
  222     PSD_INTHOUSANDTHSOFINCHES         = 0x000004,
  223     PSD_INHUNDREDTHSOFMILLIMETERS     = 0x000008,
  224     PSD_DISABLEMARGINS                = 0x000010,
  225     PSD_DISABLEPRINTER                = 0x000020,
  226     PSD_NOWARNING                     = 0x000080,
  227     PSD_DISABLEORIENTATION            = 0x000100,
  228     PSD_DISABLEPAPER                  = 0x000200,
  229     PSD_RETURNDEFAULT                 = 0x000400,
  230     PSD_SHOWHELP                      = 0x000800,
  231     PSD_ENABLEPAGESETUPHOOK           = 0x002000,
  232     PSD_ENABLEPAGESETUPTEMPLATE       = 0x008000,
  233     PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 0x020000,
  234     PSD_ENABLEPAGEPAINTHOOK           = 0x040000,
  235     PSD_DISABLEPAGEPAINTING           = 0x080000
  236 }
  237 
  238 enum : UINT {
  239     WM_PSD_PAGESETUPDLG = WM_USER,
  240     WM_PSD_FULLPAGERECT,
  241     WM_PSD_MINMARGINRECT,
  242     WM_PSD_MARGINRECT,
  243     WM_PSD_GREEKTEXTRECT,
  244     WM_PSD_ENVSTAMPRECT,
  245     WM_PSD_YAFULLPAGERECT // = WM_USER + 6
  246 }
  247 
  248 enum : int {
  249     CD_LBSELNOITEMS = -1,
  250     CD_LBSELCHANGE,
  251     CD_LBSELSUB,
  252     CD_LBSELADD
  253 }
  254 
  255 enum WORD DN_DEFAULTPRN = 1;
  256 
  257 /+
  258 // Both MinGW and the windows docs indicate that there are macros for the send messages
  259 // the controls. These seem to be totally unnecessary -- and at least one of MinGW or
  260 // Windows Docs is buggy!
  261 
  262 int CommDlg_OpenSave_GetSpec(HWND hWndControl, LPARAM lparam, WPARAM wParam) {
  263     return SendMessage(hWndControl, CDM_GETSPEC, wParam, lParam);
  264 }
  265 
  266 int CommDlg_OpenSave_GetFilePath(HWND hWndControl, LPARAM lparam, WPARAM wParam) {
  267     return SendMessage(hWndControl, CDM_GETFILEPATH, wParam, lParam);
  268 }
  269 
  270 int CommDlg_OpenSave_GetFolderPath(HWND hWndControl, LPARAM lparam, WPARAM wParam) {
  271     return SendMessage(hWndControl, CDM_GETFOLDERPATH, wParam, lParam);
  272 }
  273 
  274 int CommDlg_OpenSave_GetFolderIDList(HWND hWndControl, LPARAM lparam, WPARAM wParam) {
  275     return SendMessage(hWndControl, CDM_GETFOLDERIDLIST, wParam, lParam);
  276 }
  277 
  278 void CommDlg_OpenSave_SetControlText(HWND hWndControl, LPARAM lparam, WPARAM wParam) {
  279     return SendMessage(hWndControl, CDM_SETCONTROLTEXT, wParam, lParam);
  280 }
  281 
  282 void CommDlg_OpenSave_HideControl(HWND hWndControl, WPARAM wParam) {
  283     return SendMessage(hWndControl, CDM_HIDECONTROL, wParam, 0);
  284 }
  285 
  286 void CommDlg_OpenSave_SetDefExt(HWND hWndControl, TCHAR* lparam) {
  287     return SendMessage(hWndControl, CDM_SETCONTROLTEXT, 0, cast(LPARAM)lParam);
  288 }
  289 
  290 // These aliases seem even more unnecessary
  291 alias CommDlg_OpenSave_GetSpec
  292     CommDlg_OpenSave_GetSpecA, CommDlg_OpenSave_GetSpecW;
  293 alias CommDlg_OpenSave_GetFilePath
  294     CommDlg_OpenSave_GetFilePathA, CommDlg_OpenSave_GetFilePathW;
  295 alias CommDlg_OpenSave_GetFolderPath
  296     CommDlg_OpenSave_GetFolderPathA, CommDlg_OpenSave_GetFolderPathW;
  297 +/
  298 
  299 // Callbacks.
  300 extern(Windows) {
  301 alias UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow
  302     LPCCHOOKPROC, LPCFHOOKPROC, LPFRHOOKPROC, LPOFNHOOKPROC,
  303     LPPAGEPAINTHOOK, LPPAGESETUPHOOK, LPSETUPHOOKPROC, LPPRINTHOOKPROC;
  304 }
  305 
  306 //align (1): // 1 in Win32, default in Win64
  307 
  308 struct CHOOSECOLORA {
  309     DWORD        lStructSize = CHOOSECOLORA.sizeof;
  310     HWND         hwndOwner;
  311     HWND         hInstance;
  312     COLORREF     rgbResult;
  313     COLORREF*    lpCustColors;
  314     DWORD        Flags;
  315     LPARAM       lCustData;
  316     LPCCHOOKPROC lpfnHook;
  317     LPCSTR       lpTemplateName;
  318 }
  319 alias CHOOSECOLORA* LPCHOOSECOLORA;
  320 
  321 struct CHOOSECOLORW {
  322     DWORD        lStructSize = CHOOSECOLORW.sizeof;
  323     HWND         hwndOwner;
  324     HWND         hInstance;
  325     COLORREF     rgbResult;
  326     COLORREF*    lpCustColors;
  327     DWORD        Flags;
  328     LPARAM       lCustData;
  329     LPCCHOOKPROC lpfnHook;
  330     LPCWSTR      lpTemplateName;
  331 }
  332 alias CHOOSECOLORW* LPCHOOSECOLORW;
  333 
  334 struct CHOOSEFONTA {
  335     DWORD        lStructSize = CHOOSEFONTA.sizeof;
  336     HWND         hwndOwner;
  337     HDC          hDC;
  338     LPLOGFONTA   lpLogFont;
  339     INT          iPointSize;
  340     DWORD        Flags;
  341     DWORD        rgbColors;
  342     LPARAM       lCustData;
  343     LPCFHOOKPROC lpfnHook;
  344     LPCSTR       lpTemplateName;
  345     HINSTANCE    hInstance;
  346     LPSTR        lpszStyle;
  347     WORD         nFontType;
  348     WORD         ___MISSING_ALIGNMENT__;
  349     INT          nSizeMin;
  350     INT          nSizeMax;
  351 }
  352 alias CHOOSEFONTA* LPCHOOSEFONTA;
  353 
  354 struct CHOOSEFONTW {
  355     DWORD        lStructSize = CHOOSEFONTW.sizeof;
  356     HWND         hwndOwner;
  357     HDC          hDC;
  358     LPLOGFONTW   lpLogFont;
  359     INT          iPointSize;
  360     DWORD        Flags;
  361     DWORD        rgbColors;
  362     LPARAM       lCustData;
  363     LPCFHOOKPROC lpfnHook;
  364     LPCWSTR      lpTemplateName;
  365     HINSTANCE    hInstance;
  366     LPWSTR       lpszStyle;
  367     WORD         nFontType;
  368     WORD         ___MISSING_ALIGNMENT__;
  369     INT          nSizeMin;
  370     INT          nSizeMax;
  371 }
  372 alias CHOOSEFONTW* LPCHOOSEFONTW;
  373 
  374 struct DEVNAMES {
  375     WORD wDriverOffset;
  376     WORD wDeviceOffset;
  377     WORD wOutputOffset;
  378     WORD wDefault;
  379 }
  380 alias DEVNAMES* LPDEVNAMES;
  381 
  382 struct FINDREPLACEA {
  383     DWORD        lStructSize = FINDREPLACEA.sizeof;
  384     HWND         hwndOwner;
  385     HINSTANCE    hInstance;
  386     DWORD        Flags;
  387     LPSTR        lpstrFindWhat;
  388     LPSTR        lpstrReplaceWith;
  389     WORD         wFindWhatLen;
  390     WORD         wReplaceWithLen;
  391     LPARAM       lCustData;
  392     LPFRHOOKPROC lpfnHook;
  393     LPCSTR       lpTemplateName;
  394 }
  395 alias FINDREPLACEA* LPFINDREPLACEA;
  396 
  397 struct FINDREPLACEW {
  398     DWORD        lStructSize = FINDREPLACEW.sizeof;
  399     HWND         hwndOwner;
  400     HINSTANCE    hInstance;
  401     DWORD        Flags;
  402     LPWSTR       lpstrFindWhat;
  403     LPWSTR       lpstrReplaceWith;
  404     WORD         wFindWhatLen;
  405     WORD         wReplaceWithLen;
  406     LPARAM       lCustData;
  407     LPFRHOOKPROC lpfnHook;
  408     LPCWSTR      lpTemplateName;
  409 }
  410 alias FINDREPLACEW* LPFINDREPLACEW;
  411 
  412 struct OPENFILENAMEA {
  413     DWORD         lStructSize = OPENFILENAMEA.sizeof;
  414     HWND          hwndOwner;
  415     HINSTANCE     hInstance;
  416     LPCSTR        lpstrFilter;
  417     LPSTR         lpstrCustomFilter;
  418     DWORD         nMaxCustFilter;
  419     DWORD         nFilterIndex;
  420     LPSTR         lpstrFile;
  421     DWORD         nMaxFile;
  422     LPSTR         lpstrFileTitle;
  423     DWORD         nMaxFileTitle;
  424     LPCSTR        lpstrInitialDir;
  425     LPCSTR        lpstrTitle;
  426     DWORD         Flags;
  427     WORD          nFileOffset;
  428     WORD          nFileExtension;
  429     LPCSTR        lpstrDefExt;
  430     LPARAM        lCustData;
  431     LPOFNHOOKPROC lpfnHook;
  432     LPCSTR        lpTemplateName;
  433 
  434     //static if (_WIN32_WINNT >= 0x500) {
  435         void          *pvReserved;
  436         DWORD         dwReserved;
  437         DWORD         FlagsEx;
  438     //}
  439 }
  440 alias OPENFILENAMEA* LPOPENFILENAMEA;
  441 
  442 struct OPENFILENAMEW {
  443     DWORD         lStructSize = OPENFILENAMEW.sizeof;
  444     HWND          hwndOwner;
  445     HINSTANCE     hInstance;
  446     LPCWSTR       lpstrFilter;
  447     LPWSTR        lpstrCustomFilter;
  448     DWORD         nMaxCustFilter;
  449     DWORD         nFilterIndex;
  450     LPWSTR        lpstrFile;
  451     DWORD         nMaxFile;
  452     LPWSTR        lpstrFileTitle;
  453     DWORD         nMaxFileTitle;
  454     LPCWSTR       lpstrInitialDir;
  455     LPCWSTR       lpstrTitle;
  456     DWORD         Flags;
  457     WORD          nFileOffset;
  458     WORD          nFileExtension;
  459     LPCWSTR       lpstrDefExt;
  460     LPARAM        lCustData;
  461     LPOFNHOOKPROC lpfnHook;
  462     LPCWSTR       lpTemplateName;
  463 
  464     //static if (_WIN32_WINNT >= 0x500) {
  465         void          *pvReserved;
  466         DWORD         dwReserved;
  467         DWORD         FlagsEx;
  468     //}
  469 }
  470 alias OPENFILENAMEW* LPOPENFILENAMEW;
  471 
  472 enum size_t OPENFILENAME_SIZE_VERSION_400 = 76;
  473 
  474 struct OFNOTIFYA {
  475     NMHDR           hdr;
  476     LPOPENFILENAMEA lpOFN;
  477     LPSTR           pszFile;
  478 }
  479 alias OFNOTIFYA* LPOFNOTIFYA;
  480 
  481 struct OFNOTIFYW {
  482     NMHDR           hdr;
  483     LPOPENFILENAMEW lpOFN;
  484     LPWSTR          pszFile;
  485 }
  486 alias OFNOTIFYW* LPOFNOTIFYW;
  487 
  488 struct PAGESETUPDLGA {
  489     DWORD           lStructSize = PAGESETUPDLGA.sizeof;
  490     HWND            hwndOwner;
  491     HGLOBAL         hDevMode;
  492     HGLOBAL         hDevNames;
  493     DWORD           Flags;
  494     POINT           ptPaperSize;
  495     RECT            rtMinMargin;
  496     RECT            rtMargin;
  497     HINSTANCE       hInstance;
  498     LPARAM          lCustData;
  499     LPPAGESETUPHOOK lpfnPageSetupHook;
  500     LPPAGEPAINTHOOK lpfnPagePaintHook;
  501     LPCSTR          lpPageSetupTemplateName;
  502     HGLOBAL         hPageSetupTemplate;
  503 }
  504 alias PAGESETUPDLGA* LPPAGESETUPDLGA;
  505 
  506 struct PAGESETUPDLGW {
  507     DWORD           lStructSize = PAGESETUPDLGW.sizeof;
  508     HWND            hwndOwner;
  509     HGLOBAL         hDevMode;
  510     HGLOBAL         hDevNames;
  511     DWORD           Flags;
  512     POINT           ptPaperSize;
  513     RECT            rtMinMargin;
  514     RECT            rtMargin;
  515     HINSTANCE       hInstance;
  516     LPARAM          lCustData;
  517     LPPAGESETUPHOOK lpfnPageSetupHook;
  518     LPPAGEPAINTHOOK lpfnPagePaintHook;
  519     LPCWSTR         lpPageSetupTemplateName;
  520     HGLOBAL         hPageSetupTemplate;
  521 }
  522 alias PAGESETUPDLGW* LPPAGESETUPDLGW;
  523 
  524 align (1) struct PRINTDLGA {
  525 align(1):
  526     DWORD           lStructSize = PRINTDLGA.sizeof;
  527     version (Win64)
  528         DWORD       padding1;
  529     HWND            hwndOwner;
  530     HANDLE          hDevMode;
  531     HANDLE          hDevNames;
  532     HDC             hDC;
  533     DWORD           Flags;
  534     WORD            nFromPage;
  535     WORD            nToPage;
  536     WORD            nMinPage;
  537     WORD            nMaxPage;
  538     WORD            nCopies;
  539     version (Win64)
  540         WORD        padding2;
  541     HINSTANCE       hInstance;
  542     LPARAM          lCustData;
  543     LPPRINTHOOKPROC lpfnPrintHook;
  544     LPSETUPHOOKPROC lpfnSetupHook;
  545     LPCSTR          lpPrintTemplateName;
  546     LPCSTR          lpSetupTemplateName;
  547     HANDLE          hPrintTemplate;
  548     HANDLE          hSetupTemplate;
  549 }
  550 alias PRINTDLGA* LPPRINTDLGA;
  551 
  552 align (1) struct PRINTDLGW {
  553 align(1):
  554     DWORD           lStructSize = PRINTDLGW.sizeof;
  555     version (Win64)
  556         DWORD       padding1;
  557     HWND            hwndOwner;
  558     HANDLE          hDevMode;
  559     HANDLE          hDevNames;
  560     HDC             hDC;
  561     DWORD           Flags;
  562     WORD            nFromPage;
  563     WORD            nToPage;
  564     WORD            nMinPage;
  565     WORD            nMaxPage;
  566     WORD            nCopies;
  567     version (Win64)
  568         WORD        padding2;
  569     HINSTANCE       hInstance;
  570     LPARAM          lCustData;
  571     LPPRINTHOOKPROC lpfnPrintHook;
  572     LPSETUPHOOKPROC lpfnSetupHook;
  573     LPCWSTR         lpPrintTemplateName;
  574     LPCWSTR         lpSetupTemplateName;
  575     HANDLE          hPrintTemplate;
  576     HANDLE          hSetupTemplate;
  577 }
  578 alias PRINTDLGW* LPPRINTDLGW;
  579 
  580 //static if (_WIN32_WINNT >= 0x500) {
  581     import core.sys.windows.unknwn; // for LPUNKNOWN
  582     import core.sys.windows.prsht;  // for HPROPSHEETPAGE
  583 
  584     struct PRINTPAGERANGE {
  585         DWORD  nFromPage;
  586         DWORD  nToPage;
  587     }
  588     alias PRINTPAGERANGE* LPPRINTPAGERANGE;
  589 
  590     struct PRINTDLGEXA {
  591         DWORD            lStructSize = PRINTDLGEXA.sizeof;
  592         HWND             hwndOwner;
  593         HGLOBAL          hDevMode;
  594         HGLOBAL          hDevNames;
  595         HDC              hDC;
  596         DWORD            Flags;
  597         DWORD            Flags2;
  598         DWORD            ExclusionFlags;
  599         DWORD            nPageRanges;
  600         DWORD            nMaxPageRanges;
  601         LPPRINTPAGERANGE lpPageRanges;
  602         DWORD            nMinPage;
  603         DWORD            nMaxPage;
  604         DWORD            nCopies;
  605         HINSTANCE        hInstance;
  606         LPCSTR           lpPrintTemplateName;
  607         LPUNKNOWN        lpCallback;
  608         DWORD            nPropertyPages;
  609         HPROPSHEETPAGE*  lphPropertyPages;
  610         DWORD            nStartPage;
  611         DWORD            dwResultAction;
  612     }
  613     alias PRINTDLGEXA* LPPRINTDLGEXA;
  614 
  615     struct PRINTDLGEXW {
  616         DWORD            lStructSize = PRINTDLGEXW.sizeof;
  617         HWND             hwndOwner;
  618         HGLOBAL          hDevMode;
  619         HGLOBAL          hDevNames;
  620         HDC              hDC;
  621         DWORD            Flags;
  622         DWORD            Flags2;
  623         DWORD            ExclusionFlags;
  624         DWORD            nPageRanges;
  625         DWORD            nMaxPageRanges;
  626         LPPRINTPAGERANGE lpPageRanges;
  627         DWORD            nMinPage;
  628         DWORD            nMaxPage;
  629         DWORD            nCopies;
  630         HINSTANCE        hInstance;
  631         LPCWSTR          lpPrintTemplateName;
  632         LPUNKNOWN        lpCallback;
  633         DWORD            nPropertyPages;
  634         HPROPSHEETPAGE*  lphPropertyPages;
  635         DWORD            nStartPage;
  636         DWORD            dwResultAction;
  637     }
  638     alias PRINTDLGEXW* LPPRINTDLGEXW;
  639 
  640 //} // _WIN32_WINNT >= 0x500
  641 
  642 extern (Windows) nothrow @nogc {
  643     BOOL ChooseColorA(LPCHOOSECOLORA);
  644     BOOL ChooseColorW(LPCHOOSECOLORW);
  645     BOOL ChooseFontA(LPCHOOSEFONTA);
  646     BOOL ChooseFontW(LPCHOOSEFONTW);
  647     DWORD CommDlgExtendedError();
  648     HWND FindTextA(LPFINDREPLACEA);
  649     HWND FindTextW(LPFINDREPLACEW);
  650     short GetFileTitleA(LPCSTR, LPSTR, WORD);
  651     short GetFileTitleW(LPCWSTR, LPWSTR, WORD);
  652     BOOL GetOpenFileNameA(LPOPENFILENAMEA);
  653     BOOL GetOpenFileNameW(LPOPENFILENAMEW);
  654     BOOL GetSaveFileNameA(LPOPENFILENAMEA);
  655     BOOL GetSaveFileNameW(LPOPENFILENAMEW);
  656     BOOL PageSetupDlgA(LPPAGESETUPDLGA);
  657     BOOL PageSetupDlgW(LPPAGESETUPDLGW);
  658     BOOL PrintDlgA(LPPRINTDLGA);
  659     BOOL PrintDlgW(LPPRINTDLGW);
  660     HWND ReplaceTextA(LPFINDREPLACEA);
  661     HWND ReplaceTextW(LPFINDREPLACEW);
  662 
  663     //static if (_WIN32_WINNT >= 0x500) {
  664         HRESULT PrintDlgExA(LPPRINTDLGEXA);
  665         HRESULT PrintDlgExW(LPPRINTDLGEXW);
  666     //}
  667 }
  668 
  669 version (Unicode) {
  670     alias CHOOSECOLORW CHOOSECOLOR;
  671     alias CHOOSEFONTW CHOOSEFONT;
  672     alias FINDREPLACEW FINDREPLACE;
  673     alias OPENFILENAMEW OPENFILENAME;
  674     alias OFNOTIFYW OFNOTIFY;
  675     alias PAGESETUPDLGW PAGESETUPDLG;
  676     alias PRINTDLGW PRINTDLG;
  677 
  678     alias ChooseColorW ChooseColor;
  679     alias ChooseFontW ChooseFont;
  680     alias FindTextW FindText;
  681     alias GetFileTitleW GetFileTitle;
  682     alias GetOpenFileNameW GetOpenFileName;
  683     alias GetSaveFileNameW GetSaveFileName;
  684     alias PageSetupDlgW PageSetupDlg;
  685     alias PrintDlgW PrintDlg;
  686     alias ReplaceTextW ReplaceText;
  687 
  688     //static if (_WIN32_WINNT >= 0x500) {
  689         alias PRINTDLGEXW PRINTDLGEX;
  690         alias PrintDlgExW PrintDlgEx;
  691     //}
  692 
  693 } else { // UNICODE
  694 
  695     alias CHOOSECOLORA CHOOSECOLOR;
  696     alias CHOOSEFONTA CHOOSEFONT;
  697     alias FINDREPLACEA FINDREPLACE;
  698     alias OPENFILENAMEA OPENFILENAME;
  699     alias OFNOTIFYA OFNOTIFY;
  700     alias PAGESETUPDLGA PAGESETUPDLG;
  701     alias PRINTDLGA PRINTDLG;
  702 
  703     alias ChooseColorA ChooseColor;
  704     alias ChooseFontA ChooseFont;
  705     alias FindTextA FindText;
  706     alias GetFileTitleA GetFileTitle;
  707     alias GetOpenFileNameA GetOpenFileName;
  708     alias GetSaveFileNameA GetSaveFileName;
  709     alias PageSetupDlgA PageSetupDlg;
  710     alias PrintDlgA PrintDlg;
  711     alias ReplaceTextA ReplaceText;
  712 
  713     //static if (_WIN32_WINNT >= 0x500) {
  714         alias PRINTDLGEXA PRINTDLGEX;
  715         alias PrintDlgExA PrintDlgEx;
  716     //}
  717 
  718 } // UNICODE
  719 
  720 alias CHOOSECOLOR* LPCHOOSECOLOR;
  721 alias CHOOSEFONT* LPCHOOSEFONT;
  722 alias FINDREPLACE* LPFINDREPLACE;
  723 alias OPENFILENAME* LPOPENFILENAME;
  724 alias OFNOTIFY* LPOFNOTIFY;
  725 alias PAGESETUPDLG* LPPAGESETUPDLG;
  726 alias PRINTDLG* LPPRINTDLG;
  727 //static if (_WIN32_WINNT >= 0x500) {
  728     alias PRINTDLGEX* LPPRINTDLGEX;
  729 //}