module win32.ansi.commdlg;

// Translated from Microsoft Platform SDK August 2001 Edition
// by Y.Tomino (demoonlit@inter7.jp)

import win32.ansi.winuser;
// inline #include <cderr.h>
// ----

// #ifndef _INC_CDERR
// #define _INC_CDERR

// #if _MSC_VER > 1000
// #pragma once
// #endif

enum : uint { CDERR_DIALOGFAILURE = 0xFFFF }

enum : uint { CDERR_GENERALCODES = 0x0000 }
enum : uint { CDERR_STRUCTSIZE = 0x0001 }
enum : uint { CDERR_INITIALIZATION = 0x0002 }
enum : uint { CDERR_NOTEMPLATE = 0x0003 }
enum : uint { CDERR_NOHINSTANCE = 0x0004 }
enum : uint { CDERR_LOADSTRFAILURE = 0x0005 }
enum : uint { CDERR_FINDRESFAILURE = 0x0006 }
enum : uint { CDERR_LOADRESFAILURE = 0x0007 }
enum : uint { CDERR_LOCKRESFAILURE = 0x0008 }
enum : uint { CDERR_MEMALLOCFAILURE = 0x0009 }
enum : uint { CDERR_MEMLOCKFAILURE = 0x000A }
enum : uint { CDERR_NOHOOK = 0x000B }
enum : uint { CDERR_REGISTERMSGFAIL = 0x000C }

enum : uint { PDERR_PRINTERCODES = 0x1000 }
enum : uint { PDERR_SETUPFAILURE = 0x1001 }
enum : uint { PDERR_PARSEFAILURE = 0x1002 }
enum : uint { PDERR_RETDEFFAILURE = 0x1003 }
enum : uint { PDERR_LOADDRVFAILURE = 0x1004 }
enum : uint { PDERR_GETDEVMODEFAIL = 0x1005 }
enum : uint { PDERR_INITFAILURE = 0x1006 }
enum : uint { PDERR_NODEVICES = 0x1007 }
enum : uint { PDERR_NODEFAULTPRN = 0x1008 }
enum : uint { PDERR_DNDMMISMATCH = 0x1009 }
enum : uint { PDERR_CREATEICFAILURE = 0x100A }
enum : uint { PDERR_PRINTERNOTFOUND = 0x100B }
enum : uint { PDERR_DEFAULTDIFFERENT = 0x100C }

enum : uint { CFERR_CHOOSEFONTCODES = 0x2000 }
enum : uint { CFERR_NOFONTS = 0x2001 }
enum : uint { CFERR_MAXLESSTHANMIN = 0x2002 }

enum : uint { FNERR_FILENAMECODES = 0x3000 }
enum : uint { FNERR_SUBCLASSFAILURE = 0x3001 }
enum : uint { FNERR_INVALIDFILENAME = 0x3002 }
enum : uint { FNERR_BUFFERTOOSMALL = 0x3003 }

enum : uint { FRERR_FINDREPLACECODES = 0x4000 }
enum : uint { FRERR_BUFFERLENGTHZERO = 0x4001 }

enum : uint { CCERR_CHOOSECOLORCODES = 0x5000 }

// #endif  /* !_INC_CDERR */
// ----

// #ifndef _INC_COMMDLG
// #define _INC_COMMDLG

// #if(WINVER >= 0x0500)

// #ifdef DEFINE_GUID

// ...

// ...

// #endif

// #endif /* WINVER >= 0x0500 */

// #ifndef GUID_DEFS_ONLY

// #include <prsht.h>

// #if !defined(_WIN64)
align(1):
// #endif

// #ifdef __cplusplus
// extern "C" {            /* Assume C declarations for C++ */
// #endif  /* __cplusplus */

// #ifndef WINCOMMDLGAPI
// #if !defined(_COMDLG32_)
// #define WINCOMMDLGAPI DECLSPEC_IMPORT
// #else
// #...
// #endif
// #endif // WINCOMMDLGAPI

// #if(WINVER >= 0x0400)
// #ifndef SNDMSG
// #ifdef __cplusplus
// #ifndef _MAC
// #define SNDMSG ::SendMessage
// #else
// #...
// #endif
// #else   /* __cplusplus */
// #ifndef _MAC
// #...
// #else
// #...
// #endif
// #endif  /* __cplusplus */
// #endif  // ifndef SNDMSG
// #endif /* WINVER >= 0x0400 */

// #ifdef _MAC
// ...
// #endif

extern(Windows) alias UINT_PTR function(HWND, UINT, WPARAM, LPARAM) LPOFNHOOKPROC;

// #ifndef CDSIZEOF_STRUCT
// #define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member))
// #endif

// #ifndef DUMMYUNIONNAME
// #ifdef NONAMELESSUNION
// #...
// #endif // NONAMELESSUNION
// #endif // DUMMYUNIONNAME

struct tagOFN_NT4A {
  DWORD lStructSize;
  HWND hwndOwner;
  HINSTANCE hInstance;
  LPCSTR lpstrFilter;
  LPSTR lpstrCustomFilter;
  DWORD nMaxCustFilter;
  DWORD nFilterIndex;
  LPSTR lpstrFile;
  DWORD nMaxFile;
  LPSTR lpstrFileTitle;
  DWORD nMaxFileTitle;
  LPCSTR lpstrInitialDir;
  LPCSTR lpstrTitle;
  DWORD Flags;
  WORD nFileOffset;
  WORD nFileExtension;
  LPCSTR lpstrDefExt;
  LPARAM lCustData;
  LPOFNHOOKPROC lpfnHook;
  LPCSTR lpTemplateName;
}
alias tagOFN_NT4A OPENFILENAME_NT4A;
alias tagOFN_NT4A* LPOPENFILENAME_NT4A;

struct tagOFN_NT4W {
  DWORD lStructSize;
  HWND hwndOwner;
  HINSTANCE hInstance;
  LPCWSTR lpstrFilter;
  LPWSTR lpstrCustomFilter;
  DWORD nMaxCustFilter;
  DWORD nFilterIndex;
  LPWSTR lpstrFile;
  DWORD nMaxFile;
  LPWSTR lpstrFileTitle;
  DWORD nMaxFileTitle;
  LPCWSTR lpstrInitialDir;
  LPCWSTR lpstrTitle;
  DWORD Flags;
  WORD nFileOffset;
  WORD nFileExtension;
  LPCWSTR lpstrDefExt;
  LPARAM lCustData;
  LPOFNHOOKPROC lpfnHook;
  LPCWSTR lpTemplateName;
}
alias tagOFN_NT4W OPENFILENAME_NT4W;
alias tagOFN_NT4W* LPOPENFILENAME_NT4W;

// #ifdef UNICODE
// ...
// #else
alias OPENFILENAME_NT4A OPENFILENAME_NT4;
alias LPOPENFILENAME_NT4A LPOPENFILENAME_NT4;
// #endif // UNICODE

struct tagOFNA {
  DWORD lStructSize;
  HWND hwndOwner;
  HINSTANCE hInstance;
  LPCSTR lpstrFilter;
  LPSTR lpstrCustomFilter;
  DWORD nMaxCustFilter;
  DWORD nFilterIndex;
  LPSTR lpstrFile;
  DWORD nMaxFile;
  LPSTR lpstrFileTitle;
  DWORD nMaxFileTitle;
  LPCSTR lpstrInitialDir;
  LPCSTR lpstrTitle;
  DWORD Flags;
  WORD nFileOffset;
  WORD nFileExtension;
  LPCSTR lpstrDefExt;
  LPARAM lCustData;
  LPOFNHOOKPROC lpfnHook;
  LPCSTR lpTemplateName;
// #ifdef _MAC
// ...
// #endif
// #if (_WIN32_WINNT >= 0x0500)
  void *		pvReserved;
  DWORD dwReserved;
  DWORD FlagsEx;
// #endif // (_WIN32_WINNT >= 0x0500)
}
alias tagOFNA OPENFILENAMEA;
alias tagOFNA* LPOPENFILENAMEA;

struct tagOFNW {
  DWORD lStructSize;
  HWND hwndOwner;
  HINSTANCE hInstance;
  LPCWSTR lpstrFilter;
  LPWSTR lpstrCustomFilter;
  DWORD nMaxCustFilter;
  DWORD nFilterIndex;
  LPWSTR lpstrFile;
  DWORD nMaxFile;
  LPWSTR lpstrFileTitle;
  DWORD nMaxFileTitle;
  LPCWSTR lpstrInitialDir;
  LPCWSTR lpstrTitle;
  DWORD Flags;
  WORD nFileOffset;
  WORD nFileExtension;
  LPCWSTR lpstrDefExt;
  LPARAM lCustData;
  LPOFNHOOKPROC lpfnHook;
  LPCWSTR lpTemplateName;
// #ifdef _MAC
// ...
// #endif
// #if (_WIN32_WINNT >= 0x0500)
  void *		pvReserved;
  DWORD dwReserved;
  DWORD FlagsEx;
// #endif // (_WIN32_WINNT >= 0x0500)
}
alias tagOFNW OPENFILENAMEW;
alias tagOFNW* LPOPENFILENAMEW;

// #ifdef UNICODE
// ...
// #else
alias OPENFILENAMEA OPENFILENAME;
alias LPOPENFILENAMEA LPOPENFILENAME;
// #endif // UNICODE

// #if (_WIN32_WINNT >= 0x0500)
// #define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName)
// #define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName)
// #ifdef UNICODE
// #...
// #else
// #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400A
// #endif // !UNICODE
// #endif // (_WIN32_WINNT >= 0x0500)

extern(Windows) export BOOL GetOpenFileNameA(LPOPENFILENAMEA);
extern(Windows) export BOOL GetOpenFileNameW(LPOPENFILENAMEW);
// #ifdef UNICODE
// #...
// #else
alias GetOpenFileNameA GetOpenFileName;
// #endif // !UNICODE
extern(Windows) export BOOL GetSaveFileNameA(LPOPENFILENAMEA);
extern(Windows) export BOOL GetSaveFileNameW(LPOPENFILENAMEW);
// #ifdef UNICODE
// #...
// #else
alias GetSaveFileNameA GetSaveFileName;
// #endif // !UNICODE

extern(Windows) export short GetFileTitleA(LPCSTR, LPSTR, WORD);
extern(Windows) export short GetFileTitleW(LPCWSTR, LPWSTR, WORD);
// #ifdef UNICODE
// #...
// #else
alias GetFileTitleA GetFileTitle;
// #endif // !UNICODE

enum : uint { OFN_READONLY = 0x00000001 }
enum : uint { OFN_OVERWRITEPROMPT = 0x00000002 }
enum : uint { OFN_HIDEREADONLY = 0x00000004 }
enum : uint { OFN_NOCHANGEDIR = 0x00000008 }
enum : uint { OFN_SHOWHELP = 0x00000010 }
enum : uint { OFN_ENABLEHOOK = 0x00000020 }
enum : uint { OFN_ENABLETEMPLATE = 0x00000040 }
enum : uint { OFN_ENABLETEMPLATEHANDLE = 0x00000080 }
enum : uint { OFN_NOVALIDATE = 0x00000100 }
enum : uint { OFN_ALLOWMULTISELECT = 0x00000200 }
enum : uint { OFN_EXTENSIONDIFFERENT = 0x00000400 }
enum : uint { OFN_PATHMUSTEXIST = 0x00000800 }
enum : uint { OFN_FILEMUSTEXIST = 0x00001000 }
enum : uint { OFN_CREATEPROMPT = 0x00002000 }
enum : uint { OFN_SHAREAWARE = 0x00004000 }
enum : uint { OFN_NOREADONLYRETURN = 0x00008000 }
enum : uint { OFN_NOTESTFILECREATE = 0x00010000 }
enum : uint { OFN_NONETWORKBUTTON = 0x00020000 }
enum : uint { OFN_NOLONGNAMES = 0x00040000 }
// #if(WINVER >= 0x0400)
enum : uint { OFN_EXPLORER = 0x00080000 }
enum : uint { OFN_NODEREFERENCELINKS = 0x00100000 }
enum : uint { OFN_LONGNAMES = 0x00200000 }
enum : uint { OFN_ENABLEINCLUDENOTIFY = 0x00400000 }
enum : uint { OFN_ENABLESIZING = 0x00800000 }
// #endif /* WINVER >= 0x0400 */
// #if (_WIN32_WINNT >= 0x0500)
enum : uint { OFN_DONTADDTORECENT = 0x02000000 }
enum : uint { OFN_FORCESHOWHIDDEN = 0x10000000 }
// #endif // (_WIN32_WINNT >= 0x0500)

// #if (_WIN32_WINNT >= 0x0500)
enum : uint { OFN_EX_NOPLACESBAR = 0x00000001 }
// #endif // (_WIN32_WINNT >= 0x0500)

enum : uint { OFN_SHAREFALLTHROUGH = 2 }
enum : uint { OFN_SHARENOWARN = 1 }
enum : uint { OFN_SHAREWARN = 0 }

extern(Windows) alias UINT_PTR function(HWND, UINT, WPARAM, LPARAM) LPCCHOOKPROC;

// #if(WINVER >= 0x0400)

struct _OFNOTIFYA {
  NMHDR hdr;
  LPOPENFILENAMEA lpOFN;
  LPSTR pszFile;
}
alias _OFNOTIFYA OFNOTIFYA;
alias _OFNOTIFYA* LPOFNOTIFYA;

struct _OFNOTIFYW {
  NMHDR hdr;
  LPOPENFILENAMEW lpOFN;
  LPWSTR pszFile;
}
alias _OFNOTIFYW OFNOTIFYW;
alias _OFNOTIFYW* LPOFNOTIFYW;

// #ifdef UNICODE
// ...
// #else
alias OFNOTIFYA OFNOTIFY;
alias LPOFNOTIFYA LPOFNOTIFY;
// #endif // UNICODE

struct _OFNOTIFYEXA {
  NMHDR hdr;
  LPOPENFILENAMEA lpOFN;
  LPVOID psf;
  LPVOID pidl;
}
alias _OFNOTIFYEXA OFNOTIFYEXA;
alias _OFNOTIFYEXA* LPOFNOTIFYEXA;

struct _OFNOTIFYEXW {
  NMHDR hdr;
  LPOPENFILENAMEW lpOFN;
  LPVOID psf;
  LPVOID pidl;
}
alias _OFNOTIFYEXW OFNOTIFYEXW;
alias _OFNOTIFYEXW* LPOFNOTIFYEXW;

// #ifdef UNICODE
// ...
// #else
alias OFNOTIFYEXA OFNOTIFYEX;
alias LPOFNOTIFYEXA LPOFNOTIFYEX;
// #endif // UNICODE

enum : uint { CDN_FIRST = 0U-601U }
enum : uint { CDN_LAST = 0U-699U }

enum : uint { CDN_INITDONE = CDN_FIRST - 0x0000 }
enum : uint { CDN_SELCHANGE = CDN_FIRST - 0x0001 }
enum : uint { CDN_FOLDERCHANGE = CDN_FIRST - 0x0002 }
enum : uint { CDN_SHAREVIOLATION = CDN_FIRST - 0x0003 }
enum : uint { CDN_HELP = CDN_FIRST - 0x0004 }
enum : uint { CDN_FILEOK = CDN_FIRST - 0x0005 }
enum : uint { CDN_TYPECHANGE = CDN_FIRST - 0x0006 }
enum : uint { CDN_INCLUDEITEM = CDN_FIRST - 0x0007 }

enum : uint { CDM_FIRST = WM_USER + 100 }
enum : uint { CDM_LAST = WM_USER + 200 }

enum : uint { CDM_GETSPEC = CDM_FIRST + 0x0000 }
// #define CommDlg_OpenSave_GetSpecA(_hdlg, _psz, _cbmax) (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
// #define CommDlg_OpenSave_GetSpecW(_hdlg, _psz, _cbmax) (int)SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
// #ifdef UNICODE
// #...
// #else
// #define CommDlg_OpenSave_GetSpec CommDlg_OpenSave_GetSpecA
// #endif // !UNICODE

enum : uint { CDM_GETFILEPATH = CDM_FIRST + 0x0001 }
// #define CommDlg_OpenSave_GetFilePathA(_hdlg, _psz, _cbmax) (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
// #define CommDlg_OpenSave_GetFilePathW(_hdlg, _psz, _cbmax) (int)SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
// #ifdef UNICODE
// #...
// #else
// #define CommDlg_OpenSave_GetFilePath CommDlg_OpenSave_GetFilePathA
// #endif // !UNICODE

enum : uint { CDM_GETFOLDERPATH = CDM_FIRST + 0x0002 }
// #define CommDlg_OpenSave_GetFolderPathA(_hdlg, _psz, _cbmax) (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz)
// #define CommDlg_OpenSave_GetFolderPathW(_hdlg, _psz, _cbmax) (int)SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz)
// #ifdef UNICODE
// #...
// #else
// #define CommDlg_OpenSave_GetFolderPath CommDlg_OpenSave_GetFolderPathA
// #endif // !UNICODE

enum : uint { CDM_GETFOLDERIDLIST = CDM_FIRST + 0x0003 }
// #define CommDlg_OpenSave_GetFolderIDList(_hdlg, _pidl, _cbmax) (int)SNDMSG(_hdlg, CDM_GETFOLDERIDLIST, (WPARAM)_cbmax, (LPARAM)(LPVOID)_pidl)

enum : uint { CDM_SETCONTROLTEXT = CDM_FIRST + 0x0004 }
// #define CommDlg_OpenSave_SetControlText(_hdlg, _id, _text) (void)SNDMSG(_hdlg, CDM_SETCONTROLTEXT, (WPARAM)_id, (LPARAM)(LPSTR)_text)

enum : uint { CDM_HIDECONTROL = CDM_FIRST + 0x0005 }
// #define CommDlg_OpenSave_HideControl(_hdlg, _id) (void)SNDMSG(_hdlg, CDM_HIDECONTROL, (WPARAM)_id, 0)

enum : uint { CDM_SETDEFEXT = CDM_FIRST + 0x0006 }
// #define CommDlg_OpenSave_SetDefExt(_hdlg, _pszext) (void)SNDMSG(_hdlg, CDM_SETDEFEXT, 0, (LPARAM)(LPSTR)_pszext)
// #endif /* WINVER >= 0x0400 */

// #ifndef _MAC
struct tagCHOOSECOLORA {
  DWORD lStructSize;
  HWND hwndOwner;
  HWND hInstance;
  COLORREF rgbResult;
  COLORREF *    lpCustColors;
  DWORD Flags;
  LPARAM lCustData;
  LPCCHOOKPROC lpfnHook;
  LPCSTR lpTemplateName;
}
alias tagCHOOSECOLORA CHOOSECOLORA;
alias tagCHOOSECOLORA* LPCHOOSECOLORA;

struct tagCHOOSECOLORW {
  DWORD lStructSize;
  HWND hwndOwner;
  HWND hInstance;
  COLORREF rgbResult;
  COLORREF *    lpCustColors;
  DWORD Flags;
  LPARAM lCustData;
  LPCCHOOKPROC lpfnHook;
  LPCWSTR lpTemplateName;
}
alias tagCHOOSECOLORW CHOOSECOLORW;
alias tagCHOOSECOLORW* LPCHOOSECOLORW;

// #ifdef UNICODE
// ...
// #else
alias CHOOSECOLORA CHOOSECOLOR;
alias LPCHOOSECOLORA LPCHOOSECOLOR;
// #endif // UNICODE
// #else
// ...
// #ifdef UNICODE
// ...
// #else
// ...
// #endif // UNICODE
// #endif //_MAC

extern(Windows) export BOOL ChooseColorA(LPCHOOSECOLORA);
extern(Windows) export BOOL ChooseColorW(LPCHOOSECOLORW);
// #ifdef UNICODE
// #...
// #else
alias ChooseColorA ChooseColor;
// #endif // !UNICODE

enum : uint { CC_RGBINIT = 0x00000001 }
enum : uint { CC_FULLOPEN = 0x00000002 }
enum : uint { CC_PREVENTFULLOPEN = 0x00000004 }
enum : uint { CC_SHOWHELP = 0x00000008 }
enum : uint { CC_ENABLEHOOK = 0x00000010 }
enum : uint { CC_ENABLETEMPLATE = 0x00000020 }
enum : uint { CC_ENABLETEMPLATEHANDLE = 0x00000040 }
// #if(WINVER >= 0x0400)
enum : uint { CC_SOLIDCOLOR = 0x00000080 }
enum : uint { CC_ANYCOLOR = 0x00000100 }
// #endif /* WINVER >= 0x0400 */

extern(Windows) alias UINT_PTR function(HWND, UINT, WPARAM, LPARAM) LPFRHOOKPROC;

struct tagFINDREPLACEA {
  DWORD lStructSize;
  HWND hwndOwner;
  HINSTANCE hInstance;

  DWORD Flags;
  LPSTR lpstrFindWhat;
  LPSTR lpstrReplaceWith;
  WORD wFindWhatLen;
  WORD wReplaceWithLen;
  LPARAM lCustData;
  LPFRHOOKPROC lpfnHook;
  LPCSTR lpTemplateName;
}
alias tagFINDREPLACEA FINDREPLACEA;
alias tagFINDREPLACEA* LPFINDREPLACEA;

struct tagFINDREPLACEW {
  DWORD lStructSize;
  HWND hwndOwner;
  HINSTANCE hInstance;

  DWORD Flags;
  LPWSTR lpstrFindWhat;
  LPWSTR lpstrReplaceWith;
  WORD wFindWhatLen;
  WORD wReplaceWithLen;
  LPARAM lCustData;
  LPFRHOOKPROC lpfnHook;
  LPCWSTR lpTemplateName;
}
alias tagFINDREPLACEW FINDREPLACEW;
alias tagFINDREPLACEW* LPFINDREPLACEW;

// #ifdef UNICODE
// ...
// #else
alias FINDREPLACEA FINDREPLACE;
alias LPFINDREPLACEA LPFINDREPLACE;
// #endif // UNICODE

enum : uint { FR_DOWN = 0x00000001 }
enum : uint { FR_WHOLEWORD = 0x00000002 }
enum : uint { FR_MATCHCASE = 0x00000004 }
enum : uint { FR_FINDNEXT = 0x00000008 }
enum : uint { FR_REPLACE = 0x00000010 }
enum : uint { FR_REPLACEALL = 0x00000020 }
enum : uint { FR_DIALOGTERM = 0x00000040 }
enum : uint { FR_SHOWHELP = 0x00000080 }
enum : uint { FR_ENABLEHOOK = 0x00000100 }
enum : uint { FR_ENABLETEMPLATE = 0x00000200 }
enum : uint { FR_NOUPDOWN = 0x00000400 }
enum : uint { FR_NOMATCHCASE = 0x00000800 }
enum : uint { FR_NOWHOLEWORD = 0x00001000 }
enum : uint { FR_ENABLETEMPLATEHANDLE = 0x00002000 }
enum : uint { FR_HIDEUPDOWN = 0x00004000 }
enum : uint { FR_HIDEMATCHCASE = 0x00008000 }
enum : uint { FR_HIDEWHOLEWORD = 0x00010000 }
enum : uint { FR_RAW = 0x00020000 }
enum : uint { FR_MATCHDIAC = 0x20000000 }
enum : uint { FR_MATCHKASHIDA = 0x40000000 }
enum : uint { FR_MATCHALEFHAMZA = 0x80000000 }

extern(Windows) export HWND FindTextA(LPFINDREPLACEA);
extern(Windows) export HWND FindTextW(LPFINDREPLACEW);
// #ifdef UNICODE
// #...
// #else
alias FindTextA FindText;
// #endif // !UNICODE
// #ifndef _MAC
extern(Windows) export HWND ReplaceTextA(LPFINDREPLACEA);
extern(Windows) export HWND ReplaceTextW(LPFINDREPLACEW);
// #ifdef UNICODE
// #...
// #else
alias ReplaceTextA ReplaceText;
// #endif // !UNICODE
// #else
// ...
// #ifdef UNICODE
// #...
// #else
// #...
// #endif // !UNICODE
// #endif

extern(Windows) alias UINT_PTR function(HWND, UINT, WPARAM, LPARAM) LPCFHOOKPROC;

struct tagCHOOSEFONTA {
  DWORD lStructSize;
  HWND hwndOwner;
  HDC hDC;
  LPLOGFONTA lpLogFont;
  INT iPointSize;
  DWORD Flags;
  COLORREF rgbColors;
  LPARAM lCustData;
  LPCFHOOKPROC lpfnHook;
  LPCSTR lpTemplateName;
  HINSTANCE hInstance;

  LPSTR lpszStyle;

  WORD nFontType;

  WORD ___MISSING_ALIGNMENT__;
  INT nSizeMin;
  INT nSizeMax;

}
alias tagCHOOSEFONTA CHOOSEFONTA;
alias tagCHOOSEFONTA* LPCHOOSEFONTA;

struct tagCHOOSEFONTW {
  DWORD lStructSize;
  HWND hwndOwner;
  HDC hDC;
  LPLOGFONTW lpLogFont;
  INT iPointSize;
  DWORD Flags;
  COLORREF rgbColors;
  LPARAM lCustData;
  LPCFHOOKPROC lpfnHook;
  LPCWSTR lpTemplateName;
  HINSTANCE hInstance;

  LPWSTR lpszStyle;

  WORD nFontType;

  WORD ___MISSING_ALIGNMENT__;
  INT nSizeMin;
  INT nSizeMax;

}
alias tagCHOOSEFONTW CHOOSEFONTW;
alias tagCHOOSEFONTW* LPCHOOSEFONTW;

// #ifdef UNICODE
// ...
// #else
alias CHOOSEFONTA CHOOSEFONT;
alias LPCHOOSEFONTA LPCHOOSEFONT;
// #endif // UNICODE

extern(Windows) export BOOL ChooseFontA(LPCHOOSEFONTA);
extern(Windows) export BOOL ChooseFontW(LPCHOOSEFONTW);
// #ifdef UNICODE
// #...
// #else
alias ChooseFontA ChooseFont;
// #endif // !UNICODE

enum : uint { CF_SCREENFONTS = 0x00000001 }
enum : uint { CF_PRINTERFONTS = 0x00000002 }
enum : uint { CF_BOTH = CF_SCREENFONTS | CF_PRINTERFONTS }
enum : uint { CF_SHOWHELP = 0x00000004 }
enum : uint { CF_ENABLEHOOK = 0x00000008 }
enum : uint { CF_ENABLETEMPLATE = 0x00000010 }
enum : uint { CF_ENABLETEMPLATEHANDLE = 0x00000020 }
enum : uint { CF_INITTOLOGFONTSTRUCT = 0x00000040 }
enum : uint { CF_USESTYLE = 0x00000080 }
enum : uint { CF_EFFECTS = 0x00000100 }
enum : uint { CF_APPLY = 0x00000200 }
enum : uint { CF_ANSIONLY = 0x00000400 }
// #if(WINVER >= 0x0400)
alias CF_ANSIONLY CF_SCRIPTSONLY;
// #endif /* WINVER >= 0x0400 */
enum : uint { CF_NOVECTORFONTS = 0x00000800 }
alias CF_NOVECTORFONTS CF_NOOEMFONTS;
enum : uint { CF_NOSIMULATIONS = 0x00001000 }
enum : uint { CF_LIMITSIZE = 0x00002000 }
enum : uint { CF_FIXEDPITCHONLY = 0x00004000 }
enum : uint { CF_WYSIWYG = 0x00008000 }
enum : uint { CF_FORCEFONTEXIST = 0x00010000 }
enum : uint { CF_SCALABLEONLY = 0x00020000 }
enum : uint { CF_TTONLY = 0x00040000 }
enum : uint { CF_NOFACESEL = 0x00080000 }
enum : uint { CF_NOSTYLESEL = 0x00100000 }
enum : uint { CF_NOSIZESEL = 0x00200000 }
// #if(WINVER >= 0x0400)
enum : uint { CF_SELECTSCRIPT = 0x00400000 }
enum : uint { CF_NOSCRIPTSEL = 0x00800000 }
enum : uint { CF_NOVERTFONTS = 0x01000000 }
// #endif /* WINVER >= 0x0400 */

enum : uint { SIMULATED_FONTTYPE = 0x8000 }
enum : uint { PRINTER_FONTTYPE = 0x4000 }
enum : uint { SCREEN_FONTTYPE = 0x2000 }
enum : uint { BOLD_FONTTYPE = 0x0100 }
enum : uint { ITALIC_FONTTYPE = 0x0200 }
enum : uint { REGULAR_FONTTYPE = 0x0400 }

// #ifdef WINNT
// #...
// #...
// #...
// #endif

enum : uint { WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1 }
enum : uint { WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101 }
enum : uint { WM_CHOOSEFONT_SETFLAGS = WM_USER + 102 }

const char[] LBSELCHSTRINGA = "commdlg_LBSelChangedNotify";
const char[] SHAREVISTRINGA = "commdlg_ShareViolation";
const char[] FILEOKSTRINGA = "commdlg_FileNameOK";
const char[] COLOROKSTRINGA = "commdlg_ColorOK";
const char[] SETRGBSTRINGA = "commdlg_SetRGBColor";
const char[] HELPMSGSTRINGA = "commdlg_help";
const char[] FINDMSGSTRINGA = "commdlg_FindReplace";

const wchar[] LBSELCHSTRINGW = "commdlg_LBSelChangedNotify";
const wchar[] SHAREVISTRINGW = "commdlg_ShareViolation";
const wchar[] FILEOKSTRINGW = "commdlg_FileNameOK";
const wchar[] COLOROKSTRINGW = "commdlg_ColorOK";
const wchar[] SETRGBSTRINGW = "commdlg_SetRGBColor";
const wchar[] HELPMSGSTRINGW = "commdlg_help";
const wchar[] FINDMSGSTRINGW = "commdlg_FindReplace";

// #ifdef UNICODE
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #else
alias LBSELCHSTRINGA LBSELCHSTRING;
alias SHAREVISTRINGA SHAREVISTRING;
alias FILEOKSTRINGA FILEOKSTRING;
alias COLOROKSTRINGA COLOROKSTRING;
alias SETRGBSTRINGA SETRGBSTRING;
alias HELPMSGSTRINGA HELPMSGSTRING;
alias FINDMSGSTRINGA FINDMSGSTRING;
// #endif

enum { CD_LBSELNOITEMS = -1 }
enum : uint { CD_LBSELCHANGE = 0 }
enum : uint { CD_LBSELSUB = 1 }
enum : uint { CD_LBSELADD = 2 }

extern(Windows) alias UINT_PTR function(HWND, UINT, WPARAM, LPARAM) LPPRINTHOOKPROC;
extern(Windows) alias UINT_PTR function(HWND, UINT, WPARAM, LPARAM) LPSETUPHOOKPROC;

struct tagPDA {
  DWORD lStructSize;
  HWND hwndOwner;
  HGLOBAL hDevMode;
  HGLOBAL hDevNames;
  HDC hDC;
  DWORD Flags;
  WORD nFromPage;
  WORD nToPage;
  WORD nMinPage;
  WORD nMaxPage;
  WORD nCopies;
  HINSTANCE hInstance;
  LPARAM lCustData;
  LPPRINTHOOKPROC lpfnPrintHook;
  LPSETUPHOOKPROC lpfnSetupHook;
  LPCSTR lpPrintTemplateName;
  LPCSTR lpSetupTemplateName;
  HGLOBAL hPrintTemplate;
  HGLOBAL hSetupTemplate;
}
alias tagPDA PRINTDLGA;
alias tagPDA* LPPRINTDLGA;

struct tagPDW {
  DWORD lStructSize;
  HWND hwndOwner;
  HGLOBAL hDevMode;
  HGLOBAL hDevNames;
  HDC hDC;
  DWORD Flags;
  WORD nFromPage;
  WORD nToPage;
  WORD nMinPage;
  WORD nMaxPage;
  WORD nCopies;
  HINSTANCE hInstance;
  LPARAM lCustData;
  LPPRINTHOOKPROC lpfnPrintHook;
  LPSETUPHOOKPROC lpfnSetupHook;
  LPCWSTR lpPrintTemplateName;
  LPCWSTR lpSetupTemplateName;
  HGLOBAL hPrintTemplate;
  HGLOBAL hSetupTemplate;
}
alias tagPDW PRINTDLGW;
alias tagPDW* LPPRINTDLGW;

// #ifdef UNICODE
// ...
// #else
alias PRINTDLGA PRINTDLG;
alias LPPRINTDLGA LPPRINTDLG;
// #endif // UNICODE

extern(Windows) export BOOL PrintDlgA(LPPRINTDLGA);
extern(Windows) export BOOL PrintDlgW(LPPRINTDLGW);
// #ifdef UNICODE
// #...
// #else
alias PrintDlgA PrintDlg;
// #endif // !UNICODE

// #if(WINVER >= 0x0500)

// #ifdef STDMETHOD

// #...
// #...

// ...

// ...

// #...
// #...

// ...

// ...

// ...

// ...
// #ifdef UNICODE
// ...
// #else
// ...
// #endif // UNICODE

// ...
// #ifdef UNICODE
// #...
// #else
// #...
// #endif // !UNICODE

// #endif

// #endif /* WINVER >= 0x0500 */

enum : uint { PD_ALLPAGES = 0x00000000 }
enum : uint { PD_SELECTION = 0x00000001 }
enum : uint { PD_PAGENUMS = 0x00000002 }
enum : uint { PD_NOSELECTION = 0x00000004 }
enum : uint { PD_NOPAGENUMS = 0x00000008 }
enum : uint { PD_COLLATE = 0x00000010 }
enum : uint { PD_PRINTTOFILE = 0x00000020 }
enum : uint { PD_PRINTSETUP = 0x00000040 }
enum : uint { PD_NOWARNING = 0x00000080 }
enum : uint { PD_RETURNDC = 0x00000100 }
enum : uint { PD_RETURNIC = 0x00000200 }
enum : uint { PD_RETURNDEFAULT = 0x00000400 }
enum : uint { PD_SHOWHELP = 0x00000800 }
enum : uint { PD_ENABLEPRINTHOOK = 0x00001000 }
enum : uint { PD_ENABLESETUPHOOK = 0x00002000 }
enum : uint { PD_ENABLEPRINTTEMPLATE = 0x00004000 }
enum : uint { PD_ENABLESETUPTEMPLATE = 0x00008000 }
enum : uint { PD_ENABLEPRINTTEMPLATEHANDLE = 0x00010000 }
enum : uint { PD_ENABLESETUPTEMPLATEHANDLE = 0x00020000 }
enum : uint { PD_USEDEVMODECOPIES = 0x00040000 }
enum : uint { PD_USEDEVMODECOPIESANDCOLLATE = 0x00040000 }
enum : uint { PD_DISABLEPRINTTOFILE = 0x00080000 }
enum : uint { PD_HIDEPRINTTOFILE = 0x00100000 }
enum : uint { PD_NONETWORKBUTTON = 0x00200000 }
// #if(WINVER >= 0x0500)
enum : uint { PD_CURRENTPAGE = 0x00400000 }
enum : uint { PD_NOCURRENTPAGE = 0x00800000 }
enum : uint { PD_EXCLUSIONFLAGS = 0x01000000 }
enum : uint { PD_USELARGETEMPLATE = 0x10000000 }
// #endif /* WINVER >= 0x0500 */

// #if(WINVER >= 0x0500)

enum : uint { PD_EXCL_COPIESANDCOLLATE = DM_COPIES | DM_COLLATE }

enum : uint { START_PAGE_GENERAL = 0xffffffff }

enum : uint { PD_RESULT_CANCEL = 0 }
enum : uint { PD_RESULT_PRINT = 1 }
enum : uint { PD_RESULT_APPLY = 2 }

// #endif /* WINVER >= 0x0500 */

struct tagDEVNAMES {
  WORD wDriverOffset;
  WORD wDeviceOffset;
  WORD wOutputOffset;
  WORD wDefault;
}
alias tagDEVNAMES DEVNAMES;
alias tagDEVNAMES* LPDEVNAMES;

enum : uint { DN_DEFAULTPRN = 0x0001 }

extern(Windows) export DWORD CommDlgExtendedError();

// #if(WINVER >= 0x0400)
enum : uint { WM_PSD_PAGESETUPDLG = WM_USER  }
enum : uint { WM_PSD_FULLPAGERECT = WM_USER+1 }
enum : uint { WM_PSD_MINMARGINRECT = WM_USER+2 }
enum : uint { WM_PSD_MARGINRECT = WM_USER+3 }
enum : uint { WM_PSD_GREEKTEXTRECT = WM_USER+4 }
enum : uint { WM_PSD_ENVSTAMPRECT = WM_USER+5 }
enum : uint { WM_PSD_YAFULLPAGERECT = WM_USER+6 }

extern(Windows) alias UINT_PTR function( HWND, UINT, WPARAM, LPARAM ) LPPAGEPAINTHOOK;
extern(Windows) alias UINT_PTR function( HWND, UINT, WPARAM, LPARAM ) LPPAGESETUPHOOK;

struct tagPSDA {
  DWORD lStructSize;
  HWND hwndOwner;
  HGLOBAL hDevMode;
  HGLOBAL hDevNames;
  DWORD Flags;
  POINT ptPaperSize;
  RECT rtMinMargin;
  RECT rtMargin;
  HINSTANCE hInstance;
  LPARAM lCustData;
  LPPAGESETUPHOOK lpfnPageSetupHook;
  LPPAGEPAINTHOOK lpfnPagePaintHook;
  LPCSTR lpPageSetupTemplateName;
  HGLOBAL hPageSetupTemplate;
}
alias tagPSDA PAGESETUPDLGA;
alias tagPSDA* LPPAGESETUPDLGA;

struct tagPSDW {
  DWORD lStructSize;
  HWND hwndOwner;
  HGLOBAL hDevMode;
  HGLOBAL hDevNames;
  DWORD Flags;
  POINT ptPaperSize;
  RECT rtMinMargin;
  RECT rtMargin;
  HINSTANCE hInstance;
  LPARAM lCustData;
  LPPAGESETUPHOOK lpfnPageSetupHook;
  LPPAGEPAINTHOOK lpfnPagePaintHook;
  LPCWSTR lpPageSetupTemplateName;
  HGLOBAL hPageSetupTemplate;
}
alias tagPSDW PAGESETUPDLGW;
alias tagPSDW* LPPAGESETUPDLGW;

// #ifdef UNICODE
// ...
// #else
alias PAGESETUPDLGA PAGESETUPDLG;
alias LPPAGESETUPDLGA LPPAGESETUPDLG;
// #endif // UNICODE

extern(Windows) export BOOL PageSetupDlgA( LPPAGESETUPDLGA );
extern(Windows) export BOOL PageSetupDlgW( LPPAGESETUPDLGW );
// #ifdef UNICODE
// #...
// #else
alias PageSetupDlgA PageSetupDlg;
// #endif // !UNICODE

enum : uint { PSD_DEFAULTMINMARGINS = 0x00000000 }
enum : uint { PSD_INWININIINTLMEASURE = 0x00000000 }

enum : uint { PSD_MINMARGINS = 0x00000001 }
enum : uint { PSD_MARGINS = 0x00000002 }
enum : uint { PSD_INTHOUSANDTHSOFINCHES = 0x00000004 }
enum : uint { PSD_INHUNDREDTHSOFMILLIMETERS = 0x00000008 }
enum : uint { PSD_DISABLEMARGINS = 0x00000010 }
enum : uint { PSD_DISABLEPRINTER = 0x00000020 }
enum : uint { PSD_NOWARNING = 0x00000080 }
enum : uint { PSD_DISABLEORIENTATION = 0x00000100 }
enum : uint { PSD_RETURNDEFAULT = 0x00000400 }
enum : uint { PSD_DISABLEPAPER = 0x00000200 }
enum : uint { PSD_SHOWHELP = 0x00000800 }
enum : uint { PSD_ENABLEPAGESETUPHOOK = 0x00002000 }
enum : uint { PSD_ENABLEPAGESETUPTEMPLATE = 0x00008000 }
enum : uint { PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 0x00020000 }
enum : uint { PSD_ENABLEPAGEPAINTHOOK = 0x00040000 }
enum : uint { PSD_DISABLEPAGEPAINTING = 0x00080000 }
enum : uint { PSD_NONETWORKBUTTON = 0x00200000 }
// #endif /* WINVER >= 0x0400 */

// #if !defined(RC_INVOKED) /* RC complains about long symbols in #ifs */
// #if ISOLATION_AWARE_ENABLED

// #if !defined(ISOLATION_AWARE_INLINE)
// #if defined(__cplusplus)
// #...
// #else
// #...
// #endif
// #endif

// ...

// ...
// #if defined(STDMETHOD) && (WINVER >= 0x0500)
// ...
// #endif /* defined(STDMETHOD) && (WINVER >= 0x0500) */
// ...

// #if defined(UNICODE)

// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...

// #else /* UNICODE */

// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...

// #endif /* UNICODE */

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// ...

// #if defined(STDMETHOD) && (WINVER >= 0x0500)

// ...

// ...

// ...

// ...

// #endif /* defined(STDMETHOD) && (WINVER >= 0x0500) */

// ...

// ...

// ...

// ...

// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...
// #...

// #endif /* ISOLATION_AWARE_ENABLED */
// #endif /* RC */

// #ifdef __cplusplus
// }
// #endif  /* __cplusplus */

// #if !defined(_WIN64)
align:
// #endif
// #endif  /* GUID_DEFS_ONLY */
// #endif  /* !_INC_COMMDLG */

