Group: Printing and Print Spooler - Library: winspool.drv
The OpenPrinter function retrieves a handle to the specified printer or print server or other types of handles in the print subsystem.
Retrieving default spooling directory name
Retrieving the name of the default printer for the current user on the local computer (Win NT/XP)
How to retrieve the number of print jobs queued for the printer
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
How to retrieve configuration data for a specified printer stored in the registry (PrinterDriverData key)
How to delete all print jobs for a printer
Displaying printer-properties Property Sheet for the specified printer
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
Configuring DEVMODE structure for a printer
Enumerating forms supported by a specified printer
Using Change Notification Objects to monitor changes to the printer or print server
Printing Image File, programmatically set print page orientation to landscape
BOOL OpenPrinter(
LPTSTR pPrinterName, // printer or server name
LPHANDLE phPrinter, // printer or server handle
LPPRINTER_DEFAULTS pDefault // printer defaults
);
DECLARE INTEGER OpenPrinter IN winspool.drv;
STRING pPrinterName,;
INTEGER @ phPrinter,;
INTEGER pDefault
pPrinterName [in] Pointer to a null-terminated string that specifies the name of the printer or print server, the printer object, the XcvMonitor, or the XcvPort.
phPrinter [out] Pointer to a variable that receives a handle to the open printer or print server object.
pDefault [in] Pointer to a PRINTER_DEFAULTS structure. This value can be NULL.
If the function succeeds, the return value is a nonzero value.