Platform SDK: Active Directory, ADSI, and Directory Services

IADsPrintJobOperations

The IADsPrintJobOperations interface is used to control a print job across a network. A print job object that implements the IADsPrintJob interface will also support the following functionality for this interface:

IADsPrintJobOperations is a dual interface that inherits from IADs. The IADsPrintJobOperations interface exposes the following methods.

Methods in Vtable Order

IUnknown methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.

IDispatch methods Description
GetTypeInfoCount Gets the number of type descriptions.
GetTypeInfo Gets a description of the object's programmable interface.
GetIDsOfNames Maps the name of the method or property to DISPID.
Invoke Calls one of the object's methods, or gets and sets one of its properties.

IADsPrintJobOperations properties and methods Description
get_Status Tracks the status of the print job.
get_TimeElapsed Tracks the elapsed time, in seconds, since the job started printing.
get_PagesPrinted Tracks the number of pages completed.
get/put_Position Tracks the numeric position of the print job in the print queue.
Pause Pauses processing of this print job.
Resume Resumes processing of this print job.

Example Code [Visual Basic]

The following Visual Basic code fragment shows how this interface can be used.

Dim pqo As IADsPrintQueueOperations
Dim pjo As IADsPrintJobOperations
Set pqo = GetObject("WinNT://aMachine/aPrinter")
For each pj in pqo.PrintJobs
set pjo = pj
MsgBox "Print job status: " & Hex(pjo.status)
Next

Example Code [C++]

The following C++ code fragment shows how this interface can be used.

IADsPrintJobOperations *pjo;
IADsPrintQueueOperations *pqo;

HRESULT hr ;
hr = ADsGetObject(L"WinNT://aMachine/aPrinter", 
IID_IADsPrintQueueOperations, 
(void**)&pqo);
if (FAILED(hr)) exit(hr);
IADsCollection *pColl;
hr = pqo->PrintJobs(&pColl);

IUnknown *pUnk = NULL;
hr = pColl->get__NewEnum(&pUnk);
pColl->Release();
if (FAILED(hr) ) exit(hr);

IEnumVARIANT *pEnum;
hr = pUnk->QueryInterface(IID_IEnumVARIANT,(void**)&pEnum);
pUnk->Release();
if (FAILED(hr)) exit(hr);

// Now Enumerate
VARIANT var;
ULONG lFetch;
IDispatch *pDisp;

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

pjo->Release();
    }
VariantClear(&var);
pDisp=NULL;
hr = pEnum->Next(1, &var, &lFetch);
};
hr = pEnum->Release();
hr = pqo->Release();

Requirements

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
  Windows 95/98: Requires Windows 95 or later (with DSClient).
  Header: Declared in Iads.h.

See Also

IADsPrintJob