IBackgroundCopyManager::CreateJob method

Creates a job.

Syntax


HRESULT CreateJob(
  [in]   LPCWSTR pDisplayName,
  [in]   BG_JOB_TYPE Type,
  [out]  GUID *pJobID,
  [out]  IBackgroundCopyJob **ppJob
);

Parameters

pDisplayName [in]

Null-terminated string that contains a display name for the job. Typically, the display name is used to identify the job in a user interface. Note that more than one job may have the same display name. Must not be NULL. The name is limited to 256 characters, not including the null terminator.

Type [in]

Type of transfer job, such as BG_JOB_TYPE_DOWNLOAD. For a list of transfer types, see the BG_JOB_TYPE enumeration.

pJobID [out]

Uniquely identifies your job in the queue. Use this identifier when you call the IBackgroundCopyManager::GetJob method to get a job from the queue.

ppJob [out]

An IBackgroundCopyJob interface pointer that you use to modify the job's properties and specify the files to be transferred. To activate the job in the queue, call the IBackgroundCopyJob::Resume method. Release ppJob when done.

Return value

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

Return codeDescription
S_OK

Successfully generated the new job.

E_INVALIDARG

The display name is too long.

BG_E_TOO_MANY_JOBS_PER_MACHINE

The MaxJobsPerMachine Group Policy setting determines how many jobs can be created on the computer. Adding this job exceeds the MaxJobsPerMachine limit.

BG_E_TOO_MANY_JOBS_PER_USER

The MaxJobsPerUser Group Policy setting determines how many jobs a user can create. Adding this job exceeds the MaxJobsPerUser limit.

 

Remarks

Only the user who creates the job or a user with administrator privileges can add files to the job and change the job's properties.

By default, BITS supports a maximum of 300 jobs at one time. A single user can create a maximum of 60 jobs at one time. The user limit does not apply to administrators or service accounts. To change these defaults, set the MaxJobsPerMachine and MaxJobsPerUser group policies, respectively.

Prior to Windows Vista:  There is no limit on the number of jobs that BITS supports or that a user can create.

For scalability concerns, see Best Practices When Using BITS.

Examples

For an example that creates a new job, see Creating a Job.

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

Creating a Job
IBackgroundCopyJob
IBackgroundCopyJob::Resume

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.