Bagikan melalui


Metode IBackgroundCopyFile::GetLocalName (bits.h)

Mengambil nama lokal file.

Sintaks

HRESULT GetLocalName(
  [out] LPWSTR *pVal
);

Parameter

[out] pVal

String yang dihentikan null yang berisi nama file pada klien. Nama ini sepenuhnya memenuhi syarat. Panggil fungsi CoTaskMemFree untuk membebaskan ppName setelah selesai.

Nilai kembali

Metode ini mengembalikan S_OK pada keberhasilan atau salah satu nilai COM HRESULT standar pada kesalahan.

Keterangan

Nama file lokal diatur saat Anda memanggil metode AddFile atau AddFileSet dari antarmuka IBackgroundCopyJob .

Contoh

Contoh berikut menunjukkan cara mengambil nama file lokal dan jarak jauh dan informasi terkait kemajuan dari
Antarmuka IBackgroundCopyFile . Contoh mengasumsikan penunjuk antarmuka IBackgroundCopyFile 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);

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung Windows XP
Server minimum yang didukung Windows Server 2003
Target Platform Windows
Header bits.h
Pustaka Bits.lib
DLL QmgrPrxy.dll

Lihat juga

IBackgroundCopyFile

IBackgroundCopyFile::GetRemoteName

IBackgroundCopyJob::AddFile

IBackgroundCopyJob::AddFileSet