(0) exportieren Drucken
Alle erweitern
EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

IBackgroundCopyManager::EnumJobs method

Retrieves an interface pointer to an enumerator object that you use to enumerate the jobs in the transfer queue. The order of the jobs in the enumerator is arbitrary.

Syntax


HRESULT EnumJobs(
  [in]   DWORD dwFlags,
  [out]  IEnumBackgroundCopyJobs **ppEnumJobs
);

Parameters

dwFlags [in]

Specifies whose jobs to include in the enumeration. If dwFlags is set to 0, the user receives all jobs that they own in the transfer queue. The following table lists the enumeration options.

OptionMeaning
BG_JOB_ENUM_ALL_USERS

Includes all jobs in the transfer queue—those owned by the user and those owned by others. The user must be an administrator to use this flag.

 

ppEnumJobs [out]

An IEnumBackgroundCopyJobs interface pointer that you use to enumerate the jobs in the transfer queue. The contents of the enumerator depend on the value of dwFlags. Release ppEnumJobs when done.

Return value

This method returns the following HRESULT values, as well as others.

Return codeDescription
S_OK

Successfully generated enumerator object.

E_ACCESSDENIED

The user must be an administrator or belong to an administrator group to enumerate jobs owned by another user.

 

Examples

The enumerator object is a snapshot of the jobs in the transfer queue at the time you call the EnumJobs method. If you retrieve property values from a job in the enumerator, however, the values reflect the current property values of the job.

The following example shows how to enumerate jobs in the transfer queue. The g_XferManager variable in the example is an IBackgroundCopyManager interface pointer. For details on creating the IBackgroundCopyManager interface pointer, see Connecting to the BITS Service.


HRESULT hr = 0;
IEnumBackgroundCopyJobs* pJobs = NULL;
IBackgroundCopyJob* pJob = NULL;
ULONG cJobCount = 0;
ULONG idx = 0;

//Enumerate jobs in the queue. This example enumerates all jobs in the transfer 
//queue. This call fails if the current user does not have administrator 
//privileges. To enumerate jobs for only the current user, replace 
//BG_JOB_ENUM_ALL_USERS with 0.
hr = g_XferManager->EnumJobs(BG_JOB_ENUM_ALL_USERS, &pJobs);
if (SUCCEEDED(hr))
{
  //Get the count of jobs in the queue. 
  pJobs->GetCount(&cJobCount);

  //Enumerate the jobs in the queue.
  for (idx=0; idx<cJobCount; idx++)
  {
    hr = pJobs->Next(1, &pJob, NULL);
    if (S_OK == hr)
    {
      //Retrieve or set job properties.

      pJob->Release();
      pJob = NULL;
    }
    else
    {
      //Handle error
      break;
    }
  }

  pJobs->Release();
  pJobs = NULL;
}

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Bits.h

IDL

Bits.idl

Library

Bits.lib

DLL

QmgrPrxy.dll

IID

IID_IBackgroundCopyManager is defined as 5CE34C0D-0DC9-4C1F-897C-DAA1B78CEE7C

See also

IBackgroundCopyManager::GetJob
IBackgroundCopyJob::EnumFiles
IEnumBackgroundCopyJobs

 

 

Community-Beiträge

HINZUFÜGEN
Anzeigen:
© 2014 Microsoft