Exportieren (0) Drucken
Alle erweitern
EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

IBackgroundCopyManager::GetErrorDescription method

Retrieves a description for the specified error code.

Syntax


HRESULT GetErrorDescription(
  [in]   HRESULT hResult,
  [in]   DWORD LanguageId,
  [out]  LPWSTR *ppErrorDescription
);

Parameters

hResult [in]

Error code from a previous call to a BITS method.

LanguageId [in]

Identifies the language identifier to use to generate the description. To create the language identifier, use the MAKELANGID macro. For example, to specify U.S. English, use the following code sample.

MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)

To retrieve the system's default user language identifier, use the following calls.

LANGIDFROMLCID(GetThreadLocale())

ppErrorDescription [out]

Null-terminated string that contains a description of the error. Call the CoTaskMemFree function to free ppErrorDescription when done.

Return value

This method returns the following HRESULT values, as well as others.

Return codeDescription
S_OK

Error code description was successfully retrieved.

HRESULT_FROM_WIN32(ERROR_RESOURCE_LANG_NOT_FOUND)

No string is available for the locale.

 

Remarks

Descriptions for HTTP errors are localized.

Windows XP/2000:  Descriptions for HTTP errors are not localized.

Examples

The following example shows how to retrieve the description associated with an error code. The g_XferManager variable in the example is an IBackgroundCopyManager interface pointer. For details on creating the IBackgroundCopyManager interface pointer, see Connecting to the BITS Service.


HRESULT hr = 0;
IBackgroundCopyJob* pJob = NULL;
WCHAR* pszDescription = NULL;

//Call fails because the third parameter is NULL.
hr = g_XferManager->CreateJob(L"DummyJob", BG_JOB_TYPE_DOWNLOAD, NULL, &pJob);
if (FAILED(hr))
{
  hr = g_XferManager->GetErrorDescription(hr, LANGIDFROMLCID(GetThreadLocale()), &pszDescription);
  if (SUCCEEDED(hr))
  {
    //Do something with pszDescription.
    CoTaskMemFree(pszDescription);
  }
}

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_IBackgroundCopyManager is defined as 5CE34C0D-0DC9-4C1F-897C-DAA1B78CEE7C

See also

Handling Errors
IBackgroundCopyError
IBackgroundCopyJob::GetError

 

 

Community-Beiträge

HINZUFÜGEN
Anzeigen:
© 2015 Microsoft