📄 commdlg.h
字号:
#define CF_SELECTSCRIPT 0x00400000L
#define CF_NOSCRIPTSEL 0x00800000L
#define CF_NOVERTFONTS 0x01000000L
#endif /* WINVER >= 0x0400 */
// these are extra nFontType bits that are added to what is returned to the
// EnumFonts callback routine
#define SIMULATED_FONTTYPE 0x8000
#define PRINTER_FONTTYPE 0x4000
#define SCREEN_FONTTYPE 0x2000
#define BOLD_FONTTYPE 0x0100
#define ITALIC_FONTTYPE 0x0200
#define REGULAR_FONTTYPE 0x0400
// EnumFonts callback routine only uses these bits, so we can use the rest
// #define RASTER_FONTTYPE 0x001
// #define DEVICE_FONTTYPE 0x002
// #define TRUETYPE_FONTTYPE 0x004
#ifdef WINNT
#define PS_OPENTYPE_FONTTYPE 0x10000
#define TT_OPENTYPE_FONTTYPE 0x20000
#define TYPE1_FONTTYPE 0x40000
#endif
#define WM_CHOOSEFONT_GETLOGFONT (WM_USER + 1)
#define WM_CHOOSEFONT_SETLOGFONT (WM_USER + 101)
#define WM_CHOOSEFONT_SETFLAGS (WM_USER + 102)
// strings used to obtain unique window message for communication
// between dialog and caller
#define LBSELCHSTRINGA "commdlg_LBSelChangedNotify"
#define SHAREVISTRINGA "commdlg_ShareViolation"
#define FILEOKSTRINGA "commdlg_FileNameOK"
#define COLOROKSTRINGA "commdlg_ColorOK"
#define SETRGBSTRINGA "commdlg_SetRGBColor"
#define HELPMSGSTRINGA "commdlg_help"
#define FINDMSGSTRINGA "commdlg_FindReplace"
#define LBSELCHSTRINGW L"commdlg_LBSelChangedNotify"
#define SHAREVISTRINGW L"commdlg_ShareViolation"
#define FILEOKSTRINGW L"commdlg_FileNameOK"
#define COLOROKSTRINGW L"commdlg_ColorOK"
#define SETRGBSTRINGW L"commdlg_SetRGBColor"
#define HELPMSGSTRINGW L"commdlg_help"
#define FINDMSGSTRINGW L"commdlg_FindReplace"
#ifdef UNICODE
#define LBSELCHSTRING LBSELCHSTRINGW
#define SHAREVISTRING SHAREVISTRINGW
#define FILEOKSTRING FILEOKSTRINGW
#define COLOROKSTRING COLOROKSTRINGW
#define SETRGBSTRING SETRGBSTRINGW
#define HELPMSGSTRING HELPMSGSTRINGW
#define FINDMSGSTRING FINDMSGSTRINGW
#else
#define LBSELCHSTRING LBSELCHSTRINGA
#define SHAREVISTRING SHAREVISTRINGA
#define FILEOKSTRING FILEOKSTRINGA
#define COLOROKSTRING COLOROKSTRINGA
#define SETRGBSTRING SETRGBSTRINGA
#define HELPMSGSTRING HELPMSGSTRINGA
#define FINDMSGSTRING FINDMSGSTRINGA
#endif
// HIWORD values for lParam of commdlg_LBSelChangeNotify message
#define CD_LBSELNOITEMS -1
#define CD_LBSELCHANGE 0
#define CD_LBSELSUB 1
#define CD_LBSELADD 2
typedef UINT_PTR (CALLBACK *LPPRINTHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
typedef UINT_PTR (CALLBACK *LPSETUPHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
typedef 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;
} PRINTDLGA, *LPPRINTDLGA;
typedef 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;
} PRINTDLGW, *LPPRINTDLGW;
#ifdef UNICODE
typedef PRINTDLGW PRINTDLG;
typedef LPPRINTDLGW LPPRINTDLG;
#else
typedef PRINTDLGA PRINTDLG;
typedef LPPRINTDLGA LPPRINTDLG;
#endif // UNICODE
WINCOMMDLGAPI BOOL APIENTRY PrintDlgA(LPPRINTDLGA);
WINCOMMDLGAPI BOOL APIENTRY PrintDlgW(LPPRINTDLGW);
#ifdef UNICODE
#define PrintDlg PrintDlgW
#else
#define PrintDlg PrintDlgA
#endif // !UNICODE
#if(WINVER >= 0x0500)
#ifdef STDMETHOD
//-------------------------------------------------------------------------
//
// IPrintDialogCallback Interface
//
// IPrintDialogCallback::InitDone()
// This function is called by PrintDlgEx when the system has finished
// initializing the main page of the print dialog. This function
// should return S_OK if it has processed the action or S_FALSE to let
// PrintDlgEx perform the default action.
//
// IPrintDialogCallback::SelectionChange()
// This function is called by PrintDlgEx when a selection change occurs
// in the list view that displays the currently installed printers.
// This function should return S_OK if it has processed the action or
// S_FALSE to let PrintDlgEx perform the default action.
//
// IPrintDialogCallback::HandleMessage(hDlg, uMsg, wParam, lParam, pResult)
// This function is called by PrintDlgEx when a message is sent to the
// child window of the main page of the print dialog. This function
// should return S_OK if it has processed the action or S_FALSE to let
// PrintDlgEx perform the default action.
//
// IObjectWithSite::SetSite(punkSite)
// IPrintDialogCallback usually paired with IObjectWithSite.
// Provides the IUnknown pointer of the site to QI for the
// IPrintDialogServices interface.
//
//-------------------------------------------------------------------------
#undef INTERFACE
#define INTERFACE IPrintDialogCallback
DECLARE_INTERFACE_(IPrintDialogCallback, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
// *** IPrintDialogCallback methods ***
STDMETHOD(InitDone) (THIS) PURE;
STDMETHOD(SelectionChange) (THIS) PURE;
STDMETHOD(HandleMessage) (THIS_ HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pResult) PURE;
};
//-------------------------------------------------------------------------
//
// IPrintDialogServices Interface
//
// IPrintDialogServices::GetCurrentDevMode(pDevMode, pcbSize)
// Returns the DEVMODE structure for the currently selected printer.
//
// IPrintDialogServices::GetCurrentPrinterName(pPrinterName, pcchSize)
// Returns the printer name for the currently selected printer.
//
// IPrintDialogServices::GetCurrentPortName(pPortName, pcchSize)
// Returns the port name for the currently selected printer.
//
//-------------------------------------------------------------------------
#undef INTERFACE
#define INTERFACE IPrintDialogServices
DECLARE_INTERFACE_(IPrintDialogServices, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE;
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
STDMETHOD_(ULONG, Release) (THIS) PURE;
// *** IPrintDialogServices methods ***
STDMETHOD(GetCurrentDevMode) (THIS_ LPDEVMODE pDevMode, UINT *pcbSize) PURE;
STDMETHOD(GetCurrentPrinterName) (THIS_ LPTSTR pPrinterName, UINT *pcchSize) PURE;
STDMETHOD(GetCurrentPortName) (THIS_ LPTSTR pPortName, UINT *pcchSize) PURE;
};
//
// Page Range structure for PrintDlgEx.
//
typedef struct tagPRINTPAGERANGE {
DWORD nFromPage;
DWORD nToPage;
} PRINTPAGERANGE, *LPPRINTPAGERANGE;
//
// PrintDlgEx structure.
//
typedef struct tagPDEXA {
DWORD lStructSize; // size of structure in bytes
HWND hwndOwner; // caller's window handle
HGLOBAL hDevMode; // handle to DevMode
HGLOBAL hDevNames; // handle to DevNames
HDC hDC; // printer DC/IC or NULL
DWORD Flags; // PD_ flags
DWORD Flags2; // reserved
DWORD ExclusionFlags; // items to exclude from driver pages
DWORD nPageRanges; // number of page ranges
DWORD nMaxPageRanges; // max number of page ranges
LPPRINTPAGERANGE lpPageRanges; // array of page ranges
DWORD nMinPage; // min page number
DWORD nMaxPage; // max page number
DWORD nCopies; // number of copies
HINSTANCE hInstance; // instance handle
LPCSTR lpPrintTemplateName; // template name for app specific area
LPUNKNOWN lpCallback; // app callback interface
DWORD nPropertyPages; // number of app property pages in lphPropertyPages
HPROPSHEETPAGE *lphPropertyPages; // array of app property page handles
DWORD nStartPage; // start page id
DWORD dwResultAction; // result action if S_OK is returned
} PRINTDLGEXA, *LPPRINTDLGEXA;
//
// PrintDlgEx structure.
//
typedef struct tagPDEXW {
DWORD lStructSize; // size of structure in bytes
HWND hwndOwner; // caller's window handle
HGLOBAL hDevMode; // handle to DevMode
HGLOBAL hDevNames; // handle to DevNames
HDC hDC; // printer DC/IC or NULL
DWORD Flags; // PD_ flags
DWORD Flags2; // reserved
DWORD ExclusionFlags; // items to exclude from driver pages
DWORD nPageRanges; // number of page ranges
DWORD nMaxPageRanges; // max number of page ranges
LPPRINTPAGERANGE lpPageRanges; // array of page ranges
DWORD nMinPage; // min page number
DWORD nMaxPage; // max page number
DWORD nCopies; // number of copies
HINSTANCE hInstance; // instance handle
LPCWSTR lpPrintTemplateName; // template name for app specific area
LPUNKNOWN lpCallback; // app callback interface
DWORD nPropertyPages; // number of app property pages in lphPropertyPages
HPROPSHEETPAGE *lphPropertyPages; // array of app property page handles
DWORD nStartPage; // start page id
DWORD dwResultAction; // result action if S_OK is returned
} PRINTDLGEXW, *LPPRINTDLGEXW;
#ifdef UNICODE
typedef PRINTDLGEXW PRINTDLGEX;
typedef LPPRINTDLGEXW LPPRINTDLGEX;
#else
typedef PRINTDLGEXA PRINTDLGEX;
typedef LPPRINTDLGEXA LPPRINTDLGEX;
#endif // UNICODE
WINCOMMDLGAPI HRESULT APIENTRY PrintDlgExA(LPPRINTDLGEXA);
WINCOMMDLGAPI HRESULT APIENTRY PrintDlgExW(LPPRINTDLGEXW);
#ifdef UNICODE
#define PrintDlgEx PrintDlgExW
#else
#define PrintDlgEx PrintDlgExA
#endif // !UNICODE
#endif
#endif /* WINVER >= 0x0500 */
//
// Flags for PrintDlg and PrintDlgEx.
//
#define PD_ALLPAGES 0x00000000
#define PD_SELECTION 0x00000001
#define PD_PAGENUMS 0x00000002
#define PD_NOSELECTION 0x00000004
#define PD_NOPAGENUMS 0x00000008
#define PD_COLLATE 0x00000010
#define PD_PRINTTOFILE 0x00000020
#define PD_PRINTSETUP 0x00000040
#define PD_NOWARNING 0x00000080
#define PD_RETURNDC 0x00000100
#define PD_RETURNIC 0x00000200
#define PD_RETURNDEFAULT 0x00000400
#define PD_SHOWHELP 0x00000800
#define PD_ENABLEPRINTHOOK 0x00001000
#define PD_ENABLESETUPHOOK 0x00002000
#define PD_ENABLEPRINTTEMPLATE 0x00004000
#define PD_ENABLESETUPTEMPLATE 0x00008000
#define PD_ENABLEPRINTTEMPLATEHANDLE 0x00010000
#define PD_ENABLESETUPTEMPLATEHANDLE 0x00020000
#define PD_USEDEVMODECOPIES 0x00040000
#define PD_USEDEVMODECOPIESANDCOLLATE 0x00040000
#define PD_DISABLEPRINTTOFILE 0x00080000
#define PD_HIDEPRINTTOFILE 0x00100000
#define PD_NONETWORKBUTTON 0x00200000
#if(WINVER >= 0x0500)
#define PD_CURRENTPAGE 0x00400000
#define PD_NOCURRENTPAGE 0x00800000
#define PD_EXCLUSIONFLAGS 0x01000000
#define PD_USELARGETEMPLATE 0x10000000
#endif /* WINVER >= 0x0500 */
#if(WINVER >= 0x0500)
//
// Exclusion flags for PrintDlgEx.
//
#define PD_EXCL_COPIESANDCOLLATE (DM_COPIES | DM_COLLATE)
//
// Define the start page for the print dialog when using PrintDlgEx.
//
#define START_PAGE_GENERAL 0xffffffff
//
// Result action ids for PrintDlgEx.
//
#define PD_RESULT_CANCEL 0
#define PD_RESULT_PRINT 1
#define PD_RESULT_APPLY 2
#endif /* WINVER >= 0x0500 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -