Group: Printing and Print Spooler - Library: winspool.drv
The DocumentProperties function retrieves or modifies printer initialization information or displays a printer-configuration property sheet for the specified printer.
Configuring DEVMODE structure for a printer
Printing Image File, programmatically set print page orientation to landscape
LONG DocumentProperties(
HWND hWnd, // handle to parent window
HANDLE hPrinter, // handle to printer object
LPTSTR pDeviceName, // device name
PDEVMODE pDevModeOutput, // modified device mode
PDEVMODE pDevModeInput, // original device mode
DWORD fMode // mode options
);
DECLARE INTEGER DocumentProperties IN winspool.drv;
INTEGER hWnd,;
INTEGER hPrinter,;
STRING pDeviceName,;
STRING @ pDevModeOutput,;
STRING @ pDevModeInput,;
INTEGER fMode
hWnd [in] Handle to the parent window of the printer-configuration property sheet.
hPrinter [in] Handle to a printer object. Use the OpenPrinter or AddPrinter function to retrieve a printer handle.
pDeviceName [in] Pointer to a null-terminated string that specifies the name of the device for which the printer-configuration property sheet is displayed.
pDevModeOutput [out] Pointer to a DEVMODE structure that receives the printer configuration data specified by the user.
pDevModeInput [in] Pointer to a DEVMODE structure that the operating system uses to initialize the property sheet controls.
fMode [in] Specifies 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.
If the function fails, the return value is less than zero.
If the function displays the property sheet, the return value is either IDOK or IDCANCEL, depending on which button the user selects.
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.
Read also Microsoft Help and Support article (former Q102966) Registry Entries for Printing.
See also: PrintDlg.