The DocumentProperties function retrieves or modifies printer initialization information or displays a printer-configuration dialog box for the specified printer.
LONG DocumentProperties(
HWND hWnd, |
// handle to window that displays dialog box |
HANDLE hPrinter, |
// handle to printer object |
LPTSTR pDeviceName, |
// pointer to device name |
PDEVMODE pDevModeOutput, |
// pointer to modified device mode structure |
PDEVMODE pDevModeInput, |
// pointer to original device mode structure |
DWORD fMode |
// mode flag |
); |
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.
Value |
Meaning |
DM_IN_BUFFER |
Input 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_PROMPT |
Input value. The function presents the printer driver’s Print Setup dialog box 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_BUFFER |
Output 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. |
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 initialization dialog box, the return value is either IDOK or IDCANCEL, depending on which button the user selects.
If the function does not display the dialog box and is successful, the return value is IDOK.
If the function fails, the return value is less than zero. To get extended error information, call GetLastError.
The printer object handle identified by the hPrinter parameter can be obtained by calling the OpenPrinter function.
The string pointed to by the pDeviceName parameter can be obtained by calling the GetPrinter function.
Note that 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:
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.
AdvancedDocumentProperties, CreateDC, DEVMODE, GetPrinter, OpenPrinter
file: /Techref/os/win/api/win32/func/src/f17_7.htm, 9KB, , updated: 2000/4/7 12:19, local time: 2024/8/23 02:37,
18.118.138.10:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://piclist.com/tecHREF/os/win/api/win32/func/src/f17_7.htm"> DocumentProperties</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to piclist.com! |
.