IADsPrintJob interface

The IADsPrintJob interface is a dual interface that inherits from IADs. It is designed for representing a print job. When a user submits a request to a printer to print a document, a print job is created in the print queue. The property methods allow you to access the information about a print job. Such information includes which printer performs the printing, who submitted the document, when the document was submitted, and how many pages will be printed.

Members

The IADsPrintJob interface inherits from IDispatch and IADs. IADsPrintJob also has these types of members:

Methods

The IADsPrintJob interface has these methods.

MethodDescription
Get

Gets the value for a property by name.

GetEx

Gets the value for a single or multi-valued property by name.

GetInfo

Loads the property values of this object from the underlying directory store.

GetInfoEx

Loads specific property values of this object from the underlying directory store.

Put

Sets the value for a property by name.

PutEx

Sets the value for a single or multi-valued property by name.

SetInfo

Persists the changes on this object to the underlying directory store.

 

Properties

The IADsPrintJob interface has these properties.

PropertyAccess typeDescription

AdsPath

Read-only

Gets the object's ADsPath that uniquely identifies this object from all others.

Class

Read-only

Gets the name of the object's schema class.

Description

Read/write

Gets and sets the description of the print job.

GUID

Read-only

Gets the GUID of the object as stored in the underlying directory store.

HostPrintQueue

Read-only

Gets the ADsPath string that names the print queue processing this print job.

Name

Read-only

Gets the object's relative name.

Notify

Read/write

Gets and sets the user to be notified when job is completed.

NotifyPath

Read/write

The ADsPath string for user to be notified when the job is completed.

Parent

Read-only

Gets the ADsPath string for the parent of the object.

Priority

Read/write

Gets and sets the priority of the print job.

Schema

Read-only

Gets the ADsPath string to the schema class object for this object.

Size

Read-only

Gets the size, in bytes, of the print job.

StartTime

Read/write

Gets and sets the earliest time when the print job should be started.

TimeSubmitted

Read-only

Gets the time when the job was submitted to the print queue.

TotalPages

Read-only

Gets the total number of pages in the print job.

UntilTime

Read/write

Gets and sets the time when the print job should be stopped.

User

Read-only

Name of user that submitted the print job.

UserPath

Read-only

Gets the ADsPath name for user to submit the print job.

 

Remarks

To manage a print job across a network, use the IADsPrintJobOperations interface, which supports the functionality to examine the status of a print job and to pause or resume the operation of printing the document, and so on.

To access any print jobs in a print queue, call the IADsPrintQueueOperations::PrintJobs method to obtain the collection object holding all the print jobs in the print queue.

Examples

The following code example shows how to manage a print job submitted to the printer, "\\aMachine\aPrinter".


Dim pq As IADsPrintQueue
Dim pqo As IADsPrintQueueOperations
Dim pj As IADsPrintJob
Dim pjo As IADsPrintJobOperations
Dim pjs As IADsCollection

On Error GoTo Cleanup
 
Set pq = GetObject("WinNT://aMachine/aPrinter")
Set pqo = pq
For Each pj In pqo.PrintJobs
   MsgBox pj.class 
   MsgBox pj.description 
   MsgBox pj.HostPrintQueue
   Set pjo = pj
   If Hex(pjo.status) = 10 ' printing
      pjo.Pause
   Else
      pjo.Resume
  End If
Next

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

The following code example shows how to manage a print job submitted to the printer, "\\aMachine\aPrinter".


IADsPrintJobOperations *pjo = NULL;
IADsPrintQueueOperations *pqo = NULL;
IADsCollection *pColl = NULL;
IUnknown *pUnk = NULL;
IEnumVARIANT *pEnum = NULL;
VARIANT var;
ULONG lFetch = 0;
IDispatch *pDisp = NULL;

long status;

HRESULT hr = S_OK;
hr = ADsGetObject(L"WinNT://aMachine/aPrinter", 
                  IID_IADsPrintQueueOperations, 
                  (void**)&pqo);
if(FAILED(hr)){goto Cleanup;}

hr = pqo->PrintJobs(&pColl);

hr = pColl->get__NewEnum(&pUnk);
if(FAILED(hr)){goto Cleanup;}

hr = pUnk->QueryInterface(IID_IEnumVARIANT,(void**)&pEnum);
if(FAILED(hr)){goto Cleanup;}

// Now Enumerate
VariantInit(&var);
hr = pEnum->Next(1, &var, &lFetch);
while(hr == S_OK)
{
    if (lFetch == 1)    
    {
        pDisp = V_DISPATCH(&var);
        pDisp->QueryInterface(IID_IADsPrintJobOperations, 
                              (void**)&pjo);

        pjo->get_Status(&status);
        printf("Job status: %x\n",status);
        if(stats == ADS_JOB_PRINTING) {
            pjo.Pause();
        }
        else {
            pjo.Resume();
        }
        pjo->Release();
    }
    pDisp->Release();
    VariantClear(&var);
    hr = pEnum->Next(1, &var, &lFetch);
};

Cleanup:
    VariantClear(&var);
    if(pColl) pColl->Release();
    if(pUnk) pUnk->Release();
    if(pEnum) pEnum->Release();
    if(pqo) pqo->Release();

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Iads.h

DLL

Activeds.dll

IID

IID_IADsPrintJob is defined as 32FB6780-1ED0-11CF-A988-00AA006BC149

See also

IADsPrintJobOperations
IADsPrintQueueOperations::PrintJobs
IADsPrintJob Property Methods

 

 

Show:
© 2015 Microsoft