Directory Services

IADsPrintQueue

The IADsPrintQueue interface represents a printer on a network. It is a dual interface that inherits from IADs. The property methods of this interface allow you to access data about a printer, for example printer model, physical location, and network address.

Methods in Vtable Order

The IADsPrintQueue interface inherits the methods of the standard COM interfaces:

In addition, IADsPrintQueue defines the following methods.

Method Description
get_PrinterPath Gets and sets the path where a shared printer can be accessed.
put_PrinterPath Gets and sets the path where a shared printer can be accessed.
get_Model Gets and sets the name of the driver used by this print queue.
put_Model Gets and sets the name of the driver used by this print queue.
get_Datatype Gets and sets the data type that can be processed by this print queue.
put_Datatype Gets and sets the data type that can be processed by this print queue.
get_PrintProcessor Gets and sets the print processor associated with this print queue.
put_PrintProcessor Gets and sets the print processor associated with this print queue.
get_Description Gets and sets the description of this print queue.
put_Description Gets and sets the description of this print queue.
get_Location Gets and sets the administrator's description of the print queue location.
put_Location Gets and sets the administrator's description of the print queue location.
get_StartTime Gets and sets the time when the print queue starts processing jobs.
put_StartTime Gets and sets the time when the print queue starts processing jobs.
get_UntilTime Gets and sets the time at which the print queue stops processing jobs.
put_UntilTime Gets and sets the time at which the print queue stops processing jobs.
get_DefaultJobPriority Gets and sets the default priority assigned to each print job.
put_DefaultJobPriority Gets and sets the default priority assigned to each print job.
get_Priority Gets and sets the priority of this printer object's job queue for connected devices.
put_Priority Gets and sets the priority of this printer object's job queue for connected devices.
get_BannerPage Gets and sets the file system path to the banner page file used to separate jobs.
put_BannerPage Gets and sets the file system path to the banner page file used to separate jobs.
get_PrintDevices Gets and sets the names of print devices that this print queue uses as spooling devices.
put_PrintDevices Gets and sets the names of print devices that this print queue uses as spooling devices.
get_NetAddresses Gets and sets the binding data.
put_NetAddresses Gets and sets the binding data.

Properties

The IADsPrintQueue interface defines the following properties. The preceding table includes access methods for these properties.

Property Description
BannerPage Gets and sets the file system path to the banner page file used to separate jobs.
Datatype Gets and sets the data type that can be processed by this print queue.
DefaultJobPriority Gets and sets the default priority assigned to each print job.
Description Gets and sets the description of this print queue.
Location Gets and sets the administrator's description of the print queue location.
Model Gets and sets the name of the driver used by this print queue.
NetAddresses Gets and sets the binding data.
PrintDevices Gets and sets the names of print devices that this print queue uses as spooling devices.
PrinterPath Gets and sets the path where a shared printer can be accessed.
PrintProcessor Gets and sets the print processor associated with this print queue.
Priority Gets and sets the priority of this printer object's job queue for connected devices.
StartTime Gets and sets the time when the print queue starts processing jobs.
UntilTime Gets and sets the time at which the print queue stops processing jobs.

Remarks

Use this interface to browse a collection of print jobs in the print queue. To control a printer across a network, use the IADsPrintQueueOperations interface. To obtain a collection of the print jobs, call the IADsPrintQueueOperations::PrintJobs method.

In Windows® NT/Windows 2000, a printer, or a print queue, is managed by a host computer. If the path to a print queue is known, you can bind to it as you would to any other ADSI objects. See the following code example.

Dim pq as IADsPrintQueue
Set pq = GetObject("WinNT://aMachine/aPrinter")

or in C++,

IADsPrintQueue *pq;
LPWSTR adsPath = L"WinNT://aMachine/aPrinter";
HRESULT hr = ADsGetObject(adsPath,
						IID_IADsPrintQueue,
						(void**)&pq);

To enumerate all print queues on a given computer, proceed as follows

  1. Bind to the computer object.
  2. Determine if the computer contains any "PrintQueue" objects.
  3. Enumerate all the found printer objects.

Example Code [Visual Basic]

The following code example enumerates all the printers on a given computer.

Dim cont As IADsContainer
Dim pq As IADsPrintQueue

On Error GoTo Cleanup
 
' Bind to the computer object
Set cont = GetObject("WinNT://fabrikam1,computer")

cont.Filter = Array("PrintQueue")

For Each p In cont
   Set pq = GetObject(p.ADsPath)
   MsgBox pq.Name & " is a " & pq.Model
Next p

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If
	Set cont = Nothing
	Set pq = Nothing

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IADsPrintQueueOperations, IADsPrintQueueOperations::PrintJobs, IADsPrintQueue Property Methods