描述
显示打印对话框.的Print对话框允许用户指定一个特定的打印作业的属性.
FreeBASIC 语法
FUNCTION AfxPrinterDialog ( _ BYVAL hwndOwner AS HWND, _ BYVAL flags AS DWORD, _ BYREF hDC AS HDC, _ BYREF nCopies AS WORD, _ BYREF nFromPage AS WORD, _ BYREF nToPage AS WORD, _ BYVAL nMinPage AS WORD, _ BYVAL nMaxPage AS WORD _ ) AS BOOLEAN |
参数
hwndOwner
[in]窗口的句柄拥有对话框.这个成员可以是任何有效的窗口句柄,或者它可以NULL如果对话框没有主人.
flags
[in]初始化Print对话框.当对话框返回时,它会设置这些标志来表示用户的输入.此成员可以是下列值中的一个或多个.
PD_ALLPAGES (&H00000000???)
The default flag that indicates that the All radio button is initially selected. This flag is used as a placeholder to indicate that the PD_PAGENUMS and PD_SELECTION flags are not specified.
PD_DISABLEPRINTTOFILE (&H00080000???)
Disables the Print to File check box.
PD_HIDEPRINTTOFILE (&H00100000???)
Hides the Print to File check box.
PD_NONETWORKBUTTON (&H00200000???)
Hides and disables the Network button.
PD_NOPAGENUMS (&H00000002???)
Disables the Pages radio button and the associated edit controls. Also, it causes the Collate check box to appear in the dialog.
PD_NOSELECTION (&H00000004???)
Disables the Selection radio button.
PD_NOWARNING (&H00000080???)
Prevents the warning message from being displayed when there is no default printer.
PD_PAGENUMS (&H00000002???)
If this flag is set, the Pages radio button is selected. If this flag is set when the AfxPrinterDialog function returns, the nFromPage and nToPage members indicate the starting and ending pages specified by the user.
PD_PRINTSETUP (&H00000040???)
Causes the system to display the Print Setup dialog box rather than the Print dialog box.
PD_RETURNDC (&H00000100)
Causes AfxPrinterDialog to return a device context matching the selections the user made in the dialog box. The device context is returned in hDC.
PD_RETURNIC (&H00000200???)
Similar to the PD_RETURNDC flag, except this flag returns an information context rather than a device context. If neither PD_RETURNDC nor PD_RETURNIC is specified, hDC is undefined on output.
PD_SELECTION (&H00000001???)
If this flag is set, the Selection radio button is selected. If neither PD_PAGENUMS nor PD_SELECTION is set, the All radio button is selected.
OFN_SHOWHELP (&H00000010???)
Causes the dialog box to display the Help button. The hwndOwner member must specify the window to receive the HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button.
hDC
[in, out]关联设备句柄或上下文信息,取决于是否flags参数指定PD_RETURNDC或PC_RETURNIC旗.如果未指定任何标志,则此成员的值未定义.如果指定了双方的旗帜,PD_RETURNDC优先.
nCopies
[in, out]起始拷贝数的Copies编辑控件.当AfxPrinterDialog回报,nCopies包含副本的实际数量打印.
nFromPage
[in, out]为起始页编辑控件的初始值.
当AfxPrinterDialog回报,nFromPage是由用户指定的起始页.如果页单?磁パ≡裼没У慊?span style="font-weight: bold;">Okay按钮时,AfxPrinterDialog集PD_PAGENUMS旗帜不到用户输入一个起始页的值,在最小到最大页面范围的回报.
如果不是nFromPage或nToPage输入值在最小/最大范围,AfxPrinterDialog返回一个错误只有PD_PAGENUMS标志指定;否则,它会显示对话框,但变化的值超出范围的最小值或最大值.
nToPage
[in, out]页面的编辑控件结束的初始值.当AfxPrinterDialog回报,nToPage是由用户指定的页面结束.如果Pages选定的单?磁サ氖褂?span style="font-weight: bold;">Okay点击按钮时,AfxPrinterDialog集PD_PAGENUMS旗帜不到用户输入一个结束页值,在最小到最大页面范围的回报.
nMinPage
[in]最小值为页面范围指定在From和To页面编辑控件.如果nMinPage等于nMaxPage,'页'单?磁?开始和结束页编辑控件被禁用.
nMaxPage
[in]最大值为页面范围指定在From和To页面编辑控件.
返回值
如果用户指定一个文件名,点击OK按钮,返回值为非零.缓冲指出的bstrFile结构包含完整的路径和文件名由用户指定.
如果用户取消或关闭打开的对话框或发生错误,则返回值为零.为了获得更多的错误信息,调用CommDlgExtendedError函数,可以返回下列值之一.
CDERR_FINDRESFAILURE
CDERR_INITIALIZATION
CDERR_LOADRESFAILURE
CDERR_LOADSTRFAILURE
CDERR_LOCKRESFAILURE
CDERR_MEMALLOCFAILURE
CDERR_MEMLOCKFAILURE
CDERR_NOHINSTANCE
CDERR_NOHOOK
CDERR_NOTEMPLATE
CDERR_STRUCTSIZE
PDERR_CREATEICFAILURE
PDERR_DEFAULTDIFFERENT
PDERR_DNDMMISMATCH
PDERR_GETDEVMODEFAIL
PDERR_INITFAILURE
PDERR_LOADDRVFAILURE
PDERR_NODEFAULTPRN
PDERR_NODEVICES
PDERR_PARSEFAILURE
PDERR_PRINTERNOTFOUND
PDERR_RETDEFFAILURE
引用文件
AfxPrinter.inc