IBackgroundCopyFile::GetLocalName method (bits.h)

Retrieves the local name of the file.

Syntax

HRESULT GetLocalName(
  [out] LPWSTR *pVal
);

Parameters

[out] pVal

Null-terminated string that contains the name of the file on the client. The name is fully qualified. Call the CoTaskMemFree function to free ppName when done.

Return value

This method returns S_OK on success or one of the standard COM HRESULT values on error.

Remarks

The local file name is set when you call the AddFile or AddFileSet methods of the IBackgroundCopyJob interface.

Examples

The following example shows how to retrieve the local and remote file names and progress-related information from the
IBackgroundCopyFile interface. The example assumes the IBackgroundCopyFile interface pointer is valid.

IBackgroundCopyFile* pFile;
HRESULT hr;
WCHAR* pszLocalFileName = NULL;
WCHAR* pszRemoteFileName = NULL;
WCHAR  szPercentComplete[4+1];
BG_FILE_PROGRESS Progress;

hr = pFile->GetLocalName(&pszLocalFileName);
if (SUCCEEDED(hr))
{
  hr = pFile->GetRemoteName(&pszRemoteFileName);
  if (SUCCEEDED(hr))
  {
    pFile->GetProgress(&Progress);
    if (BG_SIZE_UNKNOWN == Progress.BytesTotal) 
    {
      StringCchPrintf(szPercentComplete, sizeof(szPercentComplete), L"0%%");
    } 
    else 
    {
      StringCchPrintf(szPercentComplete, sizeof(szPercentComplete), L"%I64d%%", 
          100*Progress.BytesTransferred/Progress.BytesTotal); 
    }
    //Do something with the file names and progress information.
  }
}
if (pszLocalFileName)
  CoTaskMemFree(pszLocalFileName);
if (pszRemoteFileName)
  CoTaskMemFree(pszRemoteFileName);

Requirements

   
Minimum supported client Windows XP
Minimum supported server Windows Server 2003
Target Platform Windows
Header bits.h
Library Bits.lib
DLL QmgrPrxy.dll

See also

IBackgroundCopyFile

IBackgroundCopyFile::GetRemoteName

IBackgroundCopyJob::AddFile

IBackgroundCopyJob::AddFileSet