CPrint.SetDefaultPrintermethod
Sets the default printer.
Syntax
FUNCTION SetDefaultPrinter (BYREF wszPrinterName AS WSTRING) AS BOOLEAN
Parameters
| Name | Description | |
|---|---|---|
wszPrinterName | A pointer to a null-terminated string containing the default printer name. For a remote printer connection, the name format is \\\server\\printername. For a local printer, the name format is printername. If this parameter is NULL or an empty string, that is, "", SetDefaultPrinter will select a default printer from one of the installed printers. If a default printer already exists, calling SetDefaultPrinter with a NULL or an empty string in this parameter might change the default printer. |
Return value
BOOLEAN. True or false.
Description
Sets the printer name of the default printer for the current user on the local computer.
Remarks
When using this method, you must specify a valid printer, driver, and port. If they are invalid, the APIs do not fail but the result is not defined. This could cause other programs to set the printer back to the previous valid printer. You can use EnumPrinters to retrieve the printer name, driver name, and port name of all available printers.
Reference
- Include file
CPrint.inc - Defined in AfxNova/CPrint.inc:138
- Documented in Printing/CPrint Class.md
- Topic: CPrint Class