📄 jwabits.pas
字号:
{$EXTERNALSYM IID_IBackgroundCopyJob}
type
IBackgroundCopyJob = interface (IUnknown)
['{37668d37-507e-4160-9316-26306d150b12}']
//--------------------------------------------------------------------
//
// Returns E_INVALIDARG if one of the filesets has
// - local name is blank
// - local name contains invalid characters
// - remote name is blank
// - remote name has invalid format
//
// Returns CO_E_NOT_SUPPORTED if
// - remote URL contains unsupported protocol
//
function AddFileSet(cFileCount: ULONG; pFileSet: PBgFileInfo): HRESULT; stdcall;
function AddFile(RemoteUrl, LocalName: LPCWSTR): HRESULT; stdcall;
//
// Gets an enumerator object for all files in the job.
//
function EnumFiles(out pEnum: IEnumBackgroundCopyFiles): HRESULT; stdcall;
//
// Pause all activity on the job. The service will take no action until one of
// Resume(), Cancel(), Complete() is called.
//
// if already suspended, just returns S_OK.
//
function Suspend: HRESULT; stdcall;
//
// Enable downloading for this job. Job properties cannot be modified
// after Resume() until the app calls Suspend().
//
// if already running, just returns S_OK.
//
function Resume: HRESULT; stdcall;
//
// Permanently stop the job. The service will delete the job metadata and downloaded files.
//
// If already cancelled or resumed, returns ???
//
function Cancel: HRESULT; stdcall;
//
// Acknowledges receipt of the job-complete notification. The service will delete
// the job metadata and leave the downloaded files.
//
function Complete: HRESULT; stdcall;
//--------------------------------------------------------------------
function GetId(out pVal: GUID): HRESULT; stdcall;
function GetType(out pVal: BG_JOB_TYPE): HRESULT; stdcall;
function GetProgress(out pVal: BG_JOB_PROGRESS): HRESULT; stdcall;
function GetTimes(out pVal: BG_JOB_TIMES): HRESULT; stdcall;
function GetState(out pVal: BG_JOB_STATE): HRESULT; stdcall;
function GetError(out ppError: IBackgroundCopyError): HRESULT; stdcall;
//
// The owner of the job, represented as a string.
// Only the owner and admins are allowed to see or change the job.
//
function GetOwner(out pVal: LPWSTR): HRESULT; stdcall;
//
// name of the job, suitable for display in UI
//
function SetDisplayName(Val: LPCWSTR): HRESULT; stdcall;
function GetDisplayName(out pVal: LPWSTR): HRESULT; stdcall;
//
// a field for use by the app
//
function SetDescription(Val: LPCWSTR): HRESULT; stdcall;
function GetDescription(out pVal: LPWSTR): HRESULT; stdcall;
//
// the priority of the job in the queue.
// default = PRIORITY_NORMAL
// values not in BG_JOB_PRIORITY return E_NOTIMPL.
//
function SetPriority(Val: BG_JOB_PRIORITY): HRESULT; stdcall;
function GetPriority(out pVal: BG_JOB_PRIORITY): HRESULT; stdcall;
//
// ignores extra flags?
//
function SetNotifyFlags(Val: ULONG): HRESULT; stdcall;
function GetNotifyFlags(out pVal: ULONG): HRESULT; stdcall;
// interface pointer that implements the IBackgroundCallback interface for notifications.
// If the pointer becomes invalid, the service will try to create a new notification object
// with the notify CLSID.
function SetNotifyInterface(Val: IUnknown): HRESULT; stdcall;
function GetNotifyInterface(out pVal: IUnknown): HRESULT; stdcall;
function SetMinimumRetryDelay(Seconds: ULONG): HRESULT; stdcall;
function GetMinimumRetryDelay(out Seconds: ULONG): HRESULT; stdcall;
function SetNoProgressTimeout(Seconds: ULONG): HRESULT; stdcall;
function GetNoProgressTimeout(out Seconds: ULONG): HRESULT; stdcall;
function GetErrorCount(out Errors: ULONG): HRESULT; stdcall;
function SetProxySettings(ProxyUsage: BG_JOB_PROXY_USAGE; ProxyList, ProxyBypassList: PWCHAR): HRESULT; stdcall;
function GetProxySettings(pProxyUsage: BG_JOB_PROXY_USAGE; pProxyList, pProxyBypassList: LPWSTR): HRESULT; stdcall;
function TakeOwnership(): HRESULT; stdcall;
end;
{$EXTERNALSYM IBackgroundCopyJob}
// ==============================================
// IEnumJobs Interface
// This interface allows enumerating the jobs under a Job
const
IID_IEnumBackgroundCopyJobs: TGUID = '{1AF4F612-3B71-466F-8F58-7B6F73AC57AD}';
{$EXTERNALSYM IID_IEnumBackgroundCopyJobs}
type
IEnumBackgroundCopyJobs = interface (IUnknown)
['{1af4f612-3b71-466f-8f58-7b6f73ac57ad}']
function Next(celt: ULONG; out rgelt: IBackgroundCopyJob; var pceltFetched: ULONG): HRESULT; stdcall;
function Skip(celt: ULONG): HRESULT; stdcall;
function Reset: HRESULT; stdcall;
function Clone(out ppenum: IEnumBackgroundCopyJobs): HRESULT; stdcall;
function GetCount(out puCount: ULONG): HRESULT; stdcall;
end;
{$EXTERNALSYM IEnumBackgroundCopyJobs}
const
BG_NOTIFY_JOB_TRANSFERRED = $0001;
{$EXTERNALSYM BG_NOTIFY_JOB_TRANSFERRED}
BG_NOTIFY_JOB_ERROR = $0002;
{$EXTERNALSYM BG_NOTIFY_JOB_ERROR}
BG_NOTIFY_DISABLE = $0004;
{$EXTERNALSYM BG_NOTIFY_DISABLE}
BG_NOTIFY_JOB_MODIFICATION = $0008;
{$EXTERNALSYM BG_NOTIFY_JOB_MODIFICATION}
// ==============================================
// IBackgroundCallback Interface
// This interface is implemented by the client and is used by the queue manager
// to supply progress information to the client.
const
IID_IBackgroundCopyCallback: TGUID = '{97EA99C7-0186-4AD4-8DF9-C5B4E0ED6B22}';
{$EXTERNALSYM IID_IBackgroundCopyCallback}
type
IBackgroundCopyCallback = interface (IUnknown)
['{97ea99c7-0186-4ad4-8df9-c5b4e0ed6b22}']
//
// A job has transferred successfully.
//
function JobTransferred(pJob: IBackgroundCopyJob): HRESULT; stdcall;
//
// An error occurred, and the service has suspended the job.
// Fix the error and resume the job.
// Get error details by calling (*pFailingJob)->GetStatus().
//
function JobError(pJob: IBackgroundCopyJob; pError: IBackgroundCopyError): HRESULT; stdcall;
//
// The job has been modified. Intendended for user interfaces.
//
function JobModification(pJob: IBackgroundCopyJob; dwReserved: DWORD): HRESULT; stdcall;
end;
{$EXTERNALSYM IBackgroundCopyCallback}
//
// IBackgroundCopyManager is the "root" interface to the background file copy component.
//
const
BG_JOB_ENUM_ALL_USERS = $0001;
{$EXTERNALSYM BG_JOB_ENUM_ALL_USERS}
IID_IBackgroundCopyManager: TGUID = '{5CE34C0D-0DC9-4C1F-897C-DAA1B78CEE7C}';
{$EXTERNALSYM IID_IBackgroundCopyManager}
type
IBackgroundCopyManager = interface (IUnknown)
['{5ce34c0d-0dc9-4c1f-897c-daa1b78cee7c}']
function CreateJob(DisplayName: LPCWSTR; Type_: BG_JOB_TYPE; out pJobId: GUID; out ppJob: IBackgroundCopyJob): HRESULT; stdcall;
function GetJob(const jobID: GUID; out ppJob: IBackgroundCopyJob): HRESULT; stdcall;
//
// Without this flag, jobs not owned by the caller are excluded from the enumeration.
// With this flag, those jobs are included. Only works if the caller is an administrator.
//
function EnumJobs(dwFlags: DWORD; out ppEnum: IEnumBackgroundCopyJobs): HRESULT; stdcall;
function GetErrorDescription(hResult: HRESULT; LanguageId: DWORD; out pErrorDescription: LPWSTR): HRESULT; stdcall;
end;
{$EXTERNALSYM IBackgroundCopyManager}
//---------------------------------------------------------------------------
const
LIBID_BackgroundCopyManager: GUID = '{4991d34b-80a1-4291-83b6-3328366b9097}';
{$EXTERNALSYM LIBID_BackgroundCopyManager}
CLSID_BackgroundCopyManager: GUID = '{4991d34b-80a1-4291-83b6-3328366b9097}';
{$EXTERNALSYM CLSID_BackgroundCopyManager}
implementation
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -