网站首页  词典首页

请输入您要查询的函数:

 

术语 documentproperties
释义 DocumentProperties
语法:
LONG DocumentProperties(
__in HWND hWnd,
__in HANDLE hPrinter,
__in LPTSTR pDeviceName,
__out PDEVMODE pDevModeOutput,
__in PDEVMODE pDevModeInput,
__in DWORD fMode
);
DocumentProperties函数
该DocumentProperties函数检索或修改打印机的初始化信息或显示指定打印机的配置属性页。
参数
hWnd [in]
一个句柄,打印机的父窗口配置属性页。
hPrinter [in]
句柄到打印机对象。使用OpenPrinter或添加打印机函数检索打印机处理。
pDeviceName [in]
一个指向 null 结尾的字符串指针,指定了该打印机配置属性表显示的设备名。
pDevModeOutput [out]
一个DEVMODE结构,它接收打印机配置由用户指定的数据指针。
pDevModeInput [in]
一个DEVMODE结构的操作系统用来初始化属性表控制指针。
此参数只用于如果DM_IN_BUFFER标志在fMode参数设置。如果DM_IN_BUFFER没有设置,操作系统使用的打印机的默认的DEVMODE。
fMode [in]
该行动的函数执行。如果此参数为0,DocumentProperties函数返回由打印机驱动程序的DEVMODE数据结构所需的字节数。否则,使用下列其中一个或多个常量建造了此参数的值,但是请注意,为了改变打印设置,应用程序必须指定至少一个输入值和一个输出值。
ValueMeaning
DM_IN_BUFFERInput价值。前提示,复制或更新,功能融合了打印机驱动程序与由pDevModeInput参数指定的DEVMODE结构设置当前打印设置。更新的功能结构只能用于DEVMODE结构的dmFields成员中指定的成员。此值也被定义为DM_MODIFY。在冲突情况下,在合并,由pDevModeInput覆盖打印机驱动程序的当前的打印设置中指定的DEVMODE结构的设置。
DM_IN_PROMPTInput价值。函数介绍了打印机驱动程序的打印设置属性表,然后更改打印机的DEVMODE数据结构的设置由用户指定的值。此值也被定义为DM_PROMPT。
DM_OUT_BUFFEROutput价值。函数写入打印机驱动程序的当前的打印设置,包括私人数据,以的DEVMODE数据结构的pDevModeOutput参数指定。调用者必须分配一个缓冲区足够大,包含的信息。如果位DM_OUT_BUFFER集明确,pDevModeOutput参数可以是NULL。此值也被定义为DM_COPY。
返回值
如果fMode参数为零,则返回值是需要包含的打印机驱动程序初始化数据缓冲区的大小。请注意,此缓冲区可能比DEVMODE结构较大如果打印机驱动程序追加私人数据的结构。
如果函数显示属性表,返回值为IDOK或IDCANCEL,这取决于用户选择按钮。
如果该函数不显示属性表和成功,则返回值为IDOK。
如果函数失败,返回值小于零。
备注
该字符串指出的pDeviceName参数,可通过调用GetPrinter函数获得。
DEVMODE结构的实际使用的打印机驱动程序包含了设备无关的部分(如上面定义),由驱动程序的特定部分,在规模和内容各有不同的驱动程序和驱动版。由于此驱动程序的依赖,这是非常重要的应用程序查询前分配这个缓冲区的DEVMODE结构正确的大小的驱动程序。
要更改打印设置,本地的应用程序,应用程序应遵循以下步骤:
获取为通过调用DocumentProperties和指定的fMode参数零充分DEVMODE结构所需的字节数。
拨出充分DEVMODE结构的内存。
通过调用DocumentProperties当前的打印机设置。一个指针传递给DEVMODE结构中的一步,因为pDevModeOutput参数2分配和指定DM_OUT_BUFFER价值。
修改返回的DEVMODE结构的适当的成员,并指出,委员们通过设置在DEVMODE的dmFields成员的相应位改变。
呼叫DocumentProperties并通过修改后的DEVMODE结构早都pDevModeInput和pDevModeOutput参数,同时指定DM_IN_BUFFER和DM_OUT_BUFFER值(组合使用OR运算符)。DEVMODE结构的第三次呼吁DocumentProperties返回的,可以用作参数在调用CreateDC函数。
要创建一个句柄打印机设备上下文使用当前打印机设置,您只需要调用DocumentProperties两次,如上所述。第一次调用得到了充分的DEVMODE规模和第二次调用初始化与当前打印机设置的DEVMODE。初始化的DEVMODE传递到CreateDC获取句柄打印机设备上下文。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinspool.h(头文件:winuser.h)
LibraryWinspool.lib
Unicode和ANSI namesDocumentPropertiesW(Unicode)和DocumentPropertiesA(ANSI)的
参见
Printing and Print Spooler Overview
Printing and Print Spooler 函数
AdvancedDocumentProperties
CreateDC
的DEVMODE
GetPrinter
OpenPrinter
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==DocumentProperties Function
The DocumentProperties function retrieves or modifies printer initialization information or displays a printer-configuration property sheet for the specified printer.
Syntax
LONG DocumentProperties(
__in HWND hWnd,
__in HANDLE hPrinter,
__in LPTSTR pDeviceName,
__out PDEVMODE pDevModeOutput,
__in PDEVMODE pDevModeInput,
__in DWORD fMode
);
Parameters
hWnd [in]
A handle to the parent window of the printer-configuration property sheet.
hPrinter [in]
A handle to a printer object. Use the OpenPrinter or AddPrinter function to retrieve a printer handle.
pDeviceName [in]
A pointer to a null-terminated string that specifies the name of the device for which the printer-configuration property sheet is displayed.
pDevModeOutput [out]
A pointer to a DEVMODE structure that receives the printer configuration data specified by the user.
pDevModeInput [in]
A pointer to a DEVMODE structure that the operating system uses to initialize the property sheet controls.
This parameter is only used if the DM_IN_BUFFER flag is set in the fMode parameter. If DM_IN_BUFFER is not set, the operating system uses the printer's default DEVMODE.
fMode [in]
The operations the function performs. If this parameter is zero, the DocumentProperties function returns the number of bytes required by the printer driver's DEVMODE data structure. Otherwise, use one or more of the following constants to construct a value for this parameter; note, however, that in order to change the print settings, an application must specify at least one input value and one output value.
ValueMeaning
DM_IN_BUFFERInput value. Before prompting, copying, or updating, the function merges the printer driver's current print settings with the settings in the DEVMODE structure specified by the pDevModeInput parameter. The function updates the structure only for those members specified by the DEVMODE structure's dmFields member. This value is also defined as DM_MODIFY. In cases of conflict during the merge, the settings in the DEVMODE structure specified by pDevModeInput override the printer driver's current print settings.
DM_IN_PROMPTInput value. The function presents the printer driver's Print Setup property sheet and then changes the settings in the printer's DEVMODE data structure to those values specified by the user. This value is also defined as DM_PROMPT.
DM_OUT_BUFFEROutput value. The function writes the printer driver's current print settings, including private data, to the DEVMODE data structure specified by the pDevModeOutput parameter. The caller must allocate a buffer sufficiently large to contain the information. If the bit DM_OUT_BUFFER sets is clear, the pDevModeOutput parameter can be NULL. This value is also defined as DM_COPY.

Return Value
If the fMode parameter is zero, the return value is the size of the buffer required to contain the printer driver initialization data. Note that this buffer can be larger than a DEVMODE structure if the printer driver appends private data to the structure.
If the function displays the property sheet, the return value is either IDOK or IDCANCEL, depending on which button the user selects.
If the function does not display the property sheet and is successful, the return value is IDOK.
If the function fails, the return value is less than zero.
Remarks
The string pointed to by the pDeviceName parameter can be obtained by calling the GetPrinter function.
The DEVMODE structure actually used by a printer driver contains the device-independent part (as defined above) followed by a driver-specific part that varies in size and content with each driver and driver version. Because of this driver dependence, it is very important for applications to query the driver for the correct size of the DEVMODE structure before allocating a buffer for it.
To make changes to print settings that are local to an application, an application should follow these steps:
Get the number of bytes required for the full DEVMODE structure by calling DocumentProperties and specifying zero in the fMode parameter.
Allocate memory for the full DEVMODE structure.
Get the current printer settings by calling DocumentProperties. Pass a pointer to the DEVMODE structure allocated in Step 2 as the pDevModeOutput parameter and specify the DM_OUT_BUFFER value.
Modify the appropriate members of the returned DEVMODE structure and indicate which members were changed by setting the corresponding bits in the dmFields member of the DEVMODE.
Call DocumentProperties and pass the modified DEVMODE structure back as both the pDevModeInput and pDevModeOutput parameters and specify both the DM_IN_BUFFER and DM_OUT_BUFFER values (which are combined using the OR operator).The DEVMODE structure returned by the third call to DocumentProperties can be used as an argument in a call to the CreateDC function.
To create a handle to a printer-device context using the current printer settings, you only need to call DocumentProperties twice, as described above. The first call gets the size of the full DEVMODE and the second call initializes the DEVMODE with the current printer settings. Pass the initialized DEVMODE to CreateDC to obtain the handle to the printer device context.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinspool.h (include Windows.h)
LibraryWinspool.lib
Unicode and ANSI namesDocumentPropertiesW (Unicode) and DocumentPropertiesA (ANSI)
See Also
Printing and Print Spooler Overview
Printing and Print Spooler Functions
AdvancedDocumentProperties
CreateDC
DEVMODE
GetPrinter
OpenPrinter
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd183576(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:29:26