Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The IADsPrintQueue interface represents a printer on a network. It is a dual interface that inherits from IADs. The property methods of this interface enables you to access data about a printer, for example printer model, physical location, and network address.
The IADsPrintQueue interface inherits from IDispatch and IADs. IADsPrintQueue also has these types of members:
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, a printer, or a print queue, is managed by a host computer. If the path to a print queue is known, bind to it as to any other ADSI objects.
The following Visual Basic code example shows the bind operation.
Dim pq as IADsPrintQueue
Set pq = GetObject("WinNT://aMachine/aPrinter")
The following C++ code example shows the bind operation.
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
The following code example enumerates 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
Requirement | Value |
---|---|
Minimum supported client | Windows Vista |
Minimum supported server | Windows Server 2008 |
Target Platform | Windows |
Header | iads.h |
IADsPrintQueue Property Methods
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!