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 code | Description |
|---|---|
|
Error code description was successfully retrieved. |
|
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, Windows 2000 Professional with SP3 [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2003, Windows 2000 Server with SP3 [desktop apps only] |
|
Header |
|
|
IDL |
|
|
Library |
|
|
DLL |
|
|
IID |
IID_IBackgroundCopyManager is defined as 5CE34C0D-0DC9-4C1F-897C-DAA1B78CEE7C |
See also
Send comments about this topic to Microsoft
Build date: 11/12/2012