IBackgroundCopyFile3::GetTemporaryName method (bits3_0.h)

Gets the full path of the temporary file that contains the content of the download.

Syntax

HRESULT GetTemporaryName(
  [out] LPWSTR *pFilename
);

Parameters

[out] pFilename

Null-terminated string that contains the full path of the temporary file. Call the CoTaskMemFree function to free ppFileName when done.

Return value

The method returns the following return values.

Return code Description
S_OK
Success

Remarks

Applications can use this method to gain access to the data before the job is complete. Open the file for shared write access (FILE_SHARE_WRITE). To determine how many bytes have been transferred and are available for reading, call the IBackgroundCopyFile::GetProgress method. Note that the progress information will be set back to zero if the time stamp of the URL changes.

Do not open the file for reading until BITS begins transferring the file; otherwise, the job will go into the transient error state.

The temporary file is available until the application calls the IBackgroundCopyJob::Complete or IBackgroundCopyJob::Cancel method, or the JobInactivityTimeout group policy expires. You must release your handle to the temporary file before calling the Complete or Cancel method.

The ACL for the temporary file is the same as that of the final file when Complete is called (the ACL is inherited from the folder).

To determine if BITS finished transferring the file, you can:

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header bits3_0.h (include Bits.h)
Library Bits.lib

See also

IBackgroundCopyCallback2::FileTransferred

IBackgroundCopyFile3