The AddPrinter function adds a printer to the list of supported printers for a specified server.
HANDLE AddPrinter(
LPTSTR pName, |
// pointer to server name |
DWORD Level, |
// printer info. structure level |
LPBYTE pPrinter |
// pointer to structure |
); |
If the function succeeds, the return value is the handle to a new printer object.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
The following list identifies the members of the PRINTER_INFO_2 structure that can be set before the AddPrinter function is called.
Attributes |
pPrintProcessor |
DefaultPriority |
Priority |
pComment |
pSecurityDescriptor |
pDatatype |
pSepFile |
pDevMode |
pShareName |
pLocation |
StartTime |
pParameters |
UntilTime |
The Status, cJobs, and AveragePPM members of the PRINTER_INFO_2 structure are reserved for use by the GetPrinter function. They must not be set before calling AddPrinter.
If pSecurityDescriptor is NULL, the system assigns a default security descriptor to the printer.
After an application creates a printer object with the AddPrinter function, it must use the PrinterProperties function to specify the correct settings for the printer driver associated with the printer object.
The AddPrinter function returns an error if a printer object with the same name already exists, unless that object is marked as pending deletion. In that case, the existing printer will not be deleted, and the AddPrinter creation parameters will be used to change the existing printer settings (as if the application had used the SetPrinter function).
Windows NT:The caller of the AddPrinter function must have SERVER_ACCESS_ADMINISTER access to the server on which the printer is to be created. The handle returned by the function will have PRINTER_ALL_ACCESS permission, and can be used to perform administrative operations on the printer.
Windows 95: This access validation is not supported in Windows 95.
Use the EnumPrintProcessors function to enumerate the set of print processors installed on a server. Use the EnumPrintProcessorDatatypes function to enumerate the set of datatypes that a print processor supports.
ClosePrinter, DeletePrinter, EnumPrintProcessors, EnumPrintProcessorDatatypes, GetPrinter, PRINTER_INFO_2, PrinterProperties, SetPrinter
file: /Techref/os/win/api/win32/func/src/f01_9.htm, 6KB, , updated: 2000/4/7 11:19, local time: 2024/11/30 16:54,
18.116.40.151: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://massmind.ecomorder.com/techref/os/win/api/win32/func/src/f01_9.htm"> AddPrinter</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.