Export (0) Print
Expand All

IBackgroundCopyFile::GetLocalName method

Retrieves the local name of the file.

Syntax


HRESULT GetLocalName(
  [out]  LPWSTR *ppName
);

Parameters

ppName [out]

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

Header

Bits.h

IDL

Bits.idl

Library

Bits.lib

DLL

QmgrPrxy.dll

IID

IID_IBackgroundCopyFile is defined as 01B7BD23-FB88-4A77-8490-5891D3E4653A

See also

IBackgroundCopyFile
IBackgroundCopyFile::GetRemoteName
IBackgroundCopyJob::AddFile
IBackgroundCopyJob::AddFileSet

 

 

Community Additions

ADD
Show:
© 2014 Microsoft