На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

AddPrinter



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
);


Parameters

pName

Pointer to a null-terminated string that specifies the name of the server on which the printer's print processor should be installed. If this string is NULL, the print processor is installed locally.

Level

Specifies the version of the structure to which pPrinter points. This value must be 2.

pPrinter

Pointer to a PRINTER_INFO_2 structure that contains information about the printer. You must specify non-NULL values for the pPrinterName, pPortName
, pDriverName, and pPrintProcessor members of this structure before calling AddPrinter.



Return Values

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.

Remarks

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.

See Also

ClosePrinter, DeletePrinter, EnumPrintProcessors, EnumPrintProcessorDatatypes, GetPrinter, PRINTER_INFO_2, PrinterProperties, SetPrinter


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

AddPrinter



Функция AddPrinter добавляет принтер к списку предусмотренных принтеров для определенного сервера.

РУЧКА AddPrinter(

LPTSTR pName, // УКАЗАТЕЛЬ в имя сервера DWORD Уровня, // инфо структурного уровня указателя принтера LPBYTE pPrinter // в структуру
);


Параметры

pName

Указатель в недействительный расторгнутую строку, которая определяет имя сервера на котором процессор распечатки принтера должен быть установлен. Если эта строка НЕДЕЙСТВИТЕЛЬНА, процессор распечатки устанавливается локально.

Уровень

Определяет версию структуры на которую точки pPrinter. Эта величина должна быть 2.

pPrinter

Указатель в структуру PRINTER_INFO_2, которая содержит информацию о принтере. Вы должны определить не-НЕДЕЙСТВИТЕЛЬНЫЕ величины для pPrinterName, pPortName , pDriverName, и участников pPrintProcessor этой структуры перед вызовом AddPrinter.



Обратные Величины

Если функция добивается успеха, обратная величина является ручкой на новый объект принтера.
Если функция терпит неудачу, обратная величина НЕДЕЙСТВИТЕЛЬНА. Для того, чтобы расширять информацию ошибки, назовите GetLastError.

Замечания

Следующее списка идентифицирует участников структуры PRINTER_INFO_2, которая может быть установлена прежде, чем функция AddPrinter будет названа.

pPrintProcessor Атрибутов DefaultPriority pSecurityDescriptor pComment Приоритета pDatatype pSepFile pDevMode pShareName pLocation StartTime pParameters UntilTime


Статус, cJobs, и участники AveragePPM структуры PRINTER_INFO_2 зарезервированы для использования функцией GetPrinter. Они не должны устанавливаны перед вызовом AddPrinter.
Если pSecurityDescriptor НЕДЕЙСТВИТЕЛЕН, система назначает по умолчанию дескриптор безопасности в принтер.
После того, как приложение создаст объект принтера с функцией AddPrinter, оно должно использовать функцию PrinterProperties, чтобы определять правильные установочные параметры для драйвера принтера связанного объектом принтера.

Функция AddPrinter возвращает ошибку если объект принтера с тем же именем уже существует, если этот объект не выделен как незаконченное удаление. В этом случае, существующий принтер не будет удален, и параметры создания AddPrinter будут использованы, чтобы изменять существующие установочные параметры принтера (как будто приложение использовало функцию SetPrinter).
Windows NT: вызывающий оператор функции AddPrinter должен иметь доступ SERVER_ACCESS_ADMINISTER к серверу на котором принтер должен быть создан. Ручка возвращанная функцией будет иметь разрешение PRINTER_ALL_ACCESS, и может быть использовано, чтобы выполнять административные операции в принтере.

Windows 95: Это подтверждение доступа не поддерживано в Windows 95.
Используйте функцию EnumPrintProcessors, чтобы перечислять установку процессоров распечатки установленной в сервере. Используйте функцию EnumPrintProcessorDatatypes, чтобы перечислять установку datatypes, что процессор распечатки поддерживает.

Смотри Также

ClosePrinter, DeletePrinter, EnumPrintProcessors, EnumPrintProcessorDatatypes, GetPrinter, PRINTER_INFO_2, PrinterProperties, SetPrinter


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz