📄 commdlg.h
字号:
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
BOOL APIENTRY PrintDlgA(LPPRINTDLGA);
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
HRESULT APIENTRY PrintDlgExA(LPPRINTDLGEXA);
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 */
//
// Device Names structure for PrintDlg and PrintDlgEx.
//
typedef struct tagDEVNAMES {
WORD wDriverOffset;
WORD wDeviceOffset;
WORD wOutputOffset;
WORD wDefault;
} DEVNAMES, *LPDEVNAMES;
#define DN_DEFAULTPRN 0x0001
DWORD APIENTRY CommDlgExtendedError(VOID);
#if(WINVER >= 0x0400)
#define WM_PSD_PAGESETUPDLG (WM_USER )
#define WM_PSD_FULLPAGERECT (WM_USER+1)
#define WM_PSD_MINMARGINRECT (WM_USER+2)
#define WM_PSD_MARGINRECT (WM_USER+3)
#define WM_PSD_GREEKTEXTRECT (WM_USER+4)
#define WM_PSD_ENVSTAMPRECT (WM_USER+5)
#define WM_PSD_YAFULLPAGERECT (WM_USER+6)
typedef UINT_PTR (APIENTRY* LPPAGEPAINTHOOK)( HWND, UINT, WPARAM, LPARAM );
typedef UINT_PTR (APIENTRY* LPPAGESETUPHOOK)( HWND, UINT, WPARAM, LPARAM );
typedef 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;
} PAGESETUPDLGA, * LPPAGESETUPDLGA;
typedef 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;
} PAGESETUPDLGW, * LPPAGESETUPDLGW;
#ifdef UNICODE
typedef PAGESETUPDLGW PAGESETUPDLG;
typedef LPPAGESETUPDLGW LPPAGESETUPDLG;
#else
typedef PAGESETUPDLGA PAGESETUPDLG;
typedef LPPAGESETUPDLGA LPPAGESETUPDLG;
#endif // UNICODE
BOOL APIENTRY PageSetupDlgA( LPPAGESETUPDLGA );
BOOL APIENTRY PageSetupDlgW( LPPAGESETUPDLGW );
#ifdef UNICODE
#define PageSetupDlg PageSetupDlgW
#else
#define PageSetupDlg PageSetupDlgA
#endif // !UNICODE
#define PSD_DEFAULTMINMARGINS 0x00000000 // default (printer's)
#define PSD_INWININIINTLMEASURE 0x00000000 // 1st of 4 possible
#define PSD_MINMARGINS 0x00000001 // use caller's
#define PSD_MARGINS 0x00000002 // use caller's
#define PSD_INTHOUSANDTHSOFINCHES 0x00000004 // 2nd of 4 possible
#define PSD_INHUNDREDTHSOFMILLIMETERS 0x00000008 // 3rd of 4 possible
#define PSD_DISABLEMARGINS 0x00000010
#define PSD_DISABLEPRINTER 0x00000020
#define PSD_NOWARNING 0x00000080 // must be same as PD_*
#define PSD_DISABLEORIENTATION 0x00000100
#define PSD_RETURNDEFAULT 0x00000400 // must be same as PD_*
#define PSD_DISABLEPAPER 0x00000200
#define PSD_SHOWHELP 0x00000800 // must be same as PD_*
#define PSD_ENABLEPAGESETUPHOOK 0x00002000 // must be same as PD_*
#define PSD_ENABLEPAGESETUPTEMPLATE 0x00008000 // must be same as PD_*
#define PSD_ENABLEPAGESETUPTEMPLATEHANDLE 0x00020000 // must be same as PD_*
#define PSD_ENABLEPAGEPAINTHOOK 0x00040000
#define PSD_DISABLEPAGEPAINTING 0x00080000
#define PSD_NONETWORKBUTTON 0x00200000 // must be same as PD_*
#endif /* WINVER >= 0x0400 */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <poppack.h>
#endif /* GUID_DEFS_ONLY */
#pragma option pop /*P_O_Pop*/
#endif /* !_INC_COMMDLG */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -