📄 jwabits.pas
字号:
{******************************************************************************}
{ }
{ Background Intelligent Transfer Service API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: bits.h, released August 2001. The original Pascal }
{ code is: Bits.pas, released October 2001. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI home }
{ page, located at http://delphi-jedi.org or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
unit JwaBits;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "bits.h"'}
{$HPPEMIT ''}
{$I WINDEFINES.INC}
interface
uses
JwaWinBase, JwaWinType, JwaBitsMsg;
const
BG_SIZE_UNKNOWN = Int64(-1);
{$EXTERNALSYM BG_SIZE_UNKNOWN}
//
// =============================
// Marshalled interfaces
// =============================
type
_BG_FILE_PROGRESS = record
BytesTotal: UINT64;
BytesTransferred: UINT64;
Completed: BOOL;
end;
{$EXTERNALSYM _BG_FILE_PROGRESS}
BG_FILE_PROGRESS = _BG_FILE_PROGRESS;
{$EXTERNALSYM BG_FILE_PROGRESS}
TBgFileProgress = BG_FILE_PROGRESS;
PBgFileProgress = ^BG_FILE_PROGRESS;
const
IID_IBackgroundCopyFile: TGUID = '{01B7BD23-FB88-4A77-8490-5891D3E4653A}';
{$EXTERNALSYM IID_IBackgroundCopyFile}
type
IBackgroundCopyFile = interface (IUnknown)
['{01b7bd23-fb88-4a77-8490-5891d3e4653a}']
function GetRemoteName(out pVal: LPWSTR): HRESULT; stdcall;
function GetLocalName(out pVal: LPWSTR): HRESULT; stdcall;
function GetProgress(out pVal: BG_FILE_PROGRESS): HRESULT; stdcall;
end;
{$EXTERNALSYM IBackgroundCopyFile}
//--------------------------------------------------------------------
//
const
IID_IEnumBackgroundCopyFiles: TGUID = '{CA51E165-C365-424C-8D41-24AAA4FF3C40}';
{$EXTERNALSYM IID_IEnumBackgroundCopyFiles}
type
IEnumBackgroundCopyFiles = interface (IUnknown)
['{ca51e165-c365-424c-8d41-24aaa4ff3c40}']
function Next(celt: ULONG; out rgelt: IBackgroundCopyFile; var pceltFetched: ULONG): HRESULT; stdcall;
function Skip(celt: ULONG): HRESULT; stdcall;
function Reset: HRESULT; stdcall;
function Clone(out ppenum: IEnumBackgroundCopyFiles): HRESULT; stdcall;
function GetCount(out puCount: ULONG): HRESULT; stdcall;
end;
{$EXTERNALSYM IEnumBackgroundCopyFiles}
//--------------------------------------------------------------------
//
type
BG_ERROR_CONTEXT = (
BG_ERROR_CONTEXT_NONE,
BG_ERROR_CONTEXT_UNKNOWN,
BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER,
BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION,
BG_ERROR_CONTEXT_LOCAL_FILE,
BG_ERROR_CONTEXT_REMOTE_FILE,
BG_ERROR_CONTEXT_GENERAL_TRANSPORT,
BG_ERROR_CONTEXT_REMOTE_APPLICATION);
{$EXTERNALSYM BG_ERROR_CONTEXT}
TBgErrorContext = BG_ERROR_CONTEXT;
const
IID_IBackgroundCopyError: TGUID = '{19C613A0-FCB8-4F28-81AE-897C3D078F81}';
{$EXTERNALSYM IID_IBackgroundCopyError}
type
IBackgroundCopyError = interface (IUnknown)
['{19c613a0-fcb8-4f28-81ae-897c3d078f81}']
function GetError(out pContext: BG_ERROR_CONTEXT; out pCode: HRESULT): HRESULT; stdcall;
// Returns BG_E_FILE_NOT_AVAILABLE if no file is available
function GetFile(out ppVal: IBackgroundCopyFile): HRESULT; stdcall;
// Return a human readable description of the error.
// Use CoTaskMemFree to free the description.
function GetErrorDescription(LanguageId: DWORD; out pErrorDescription: LPWSTR): HRESULT; stdcall;
// Return a human readable description of the error context.
// Use CoTaskMemFree to free the description.
function GetErrorContextDescription(LanguageId: DWORD; out pContextDescription: LPWSTR): HRESULT; stdcall;
// Returns BG_E_PROTOCOL_NOT_AVAILABLE if no protocol is available
function GetProtocol(out pProtocol: LPWSTR): HRESULT; stdcall;
end;
{$EXTERNALSYM IBackgroundCopyError}
// ==============================================
// Job Interface
type
_BG_FILE_INFO = record
RemoteName: LPWSTR;
LocalName: LPWSTR;
end;
{$EXTERNALSYM _BG_FILE_INFO}
BG_FILE_INFO = _BG_FILE_INFO;
{$EXTERNALSYM BG_FILE_INFO}
TBgFileInfo = BG_FILE_INFO;
PBgFileInfo = ^BG_FILE_INFO;
_BG_JOB_PROGRESS = record
BytesTotal: UINT64;
BytesTransferred: UINT64;
FilesTotal: ULONG;
FilesTransferred: ULONG;
end;
{$EXTERNALSYM _BG_JOB_PROGRESS}
BG_JOB_PROGRESS = _BG_JOB_PROGRESS;
{$EXTERNALSYM BG_JOB_PROGRESS}
TBgJobProgress = BG_JOB_PROGRESS;
PBgJobProgress = ^BG_JOB_PROGRESS;
_BG_JOB_TIMES = record
CreationTime: FILETIME;
ModificationTime: FILETIME;
TransferCompletionTime: FILETIME;
end;
{$EXTERNALSYM _BG_JOB_TIMES}
BG_JOB_TIMES = _BG_JOB_TIMES;
{$EXTERNALSYM BG_JOB_TIMES}
TBgJobTimes = BG_JOB_TIMES;
PBgJobTimes = ^BG_JOB_TIMES;
BG_JOB_PRIORITY = (
BG_JOB_PRIORITY_FOREGROUND,
BG_JOB_PRIORITY_HIGH,
BG_JOB_PRIORITY_NORMAL,
BG_JOB_PRIORITY_LOW);
{$EXTERNALSYM BG_JOB_PRIORITY}
TBgJobPriority = BG_JOB_PRIORITY;
PBgJobPriority = ^BG_JOB_PRIORITY;
BG_JOB_STATE = (
BG_JOB_STATE_QUEUED,
BG_JOB_STATE_CONNECTING,
BG_JOB_STATE_TRANSFERRING,
BG_JOB_STATE_SUSPENDED,
BG_JOB_STATE_ERROR,
BG_JOB_STATE_TRANSIENT_ERROR,
BG_JOB_STATE_TRANSFERRED,
BG_JOB_STATE_ACKNOWLEDGED,
BG_JOB_STATE_CANCELLED);
{$EXTERNALSYM BG_JOB_STATE}
TBgJobState = BG_JOB_STATE;
PBgJobState = ^BG_JOB_STATE;
BG_JOB_TYPE = (
BG_JOB_TYPE_DOWNLOAD,
BG_JOB_TYPE_UPLOAD,
BG_JOB_TYPE_UPLOAD_REPLY);
{$EXTERNALSYM BG_JOB_TYPE}
TBgJobType = BG_JOB_TYPE;
BG_JOB_PROXY_USAGE = (
BG_JOB_PROXY_USAGE_PRECONFIG,
BG_JOB_PROXY_USAGE_NO_PROXY,
BG_JOB_PROXY_USAGE_OVERRIDE);
{$EXTERNALSYM BG_JOB_PROXY_USAGE}
TBgJobProxyUsage = BG_JOB_PROXY_USAGE;
PBgJobProxyUsage = ^BG_JOB_PROXY_USAGE;
const
IID_IBackgroundCopyJob: TGUID = '{37668D37-507E-4160-9316-26306D150B12}';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -