Retrieving Network Errors (Windows Embedded CE 6.0)
1/6/2010
An application can call the GetLastError function to get extended data on an error, including the error value. Error data is usually provider-specific; however, the only provider supported by Windows Embedded CE is the Microsoft Windows Network provider.
The following code example shows a sample function, ErrorHandler, for application-defined error handling. This function calls GetLastError to get extended error data. The ErrorHandler takes two parameters: a window handle and the name of the function that produced the error.
BOOL WINAPI ErrorHandler (HWND hwnd, DWORD dwError, LPTSTR lpszFunction)
{
DWORD dwLastError;
TCHAR szError[256],
szCaption[256];
// The following code performs extended error handling.
dwLastError = GetLastError ();
wsprintf (szError,
TEXT("%s failed with error code %ld \n")
TEXT("and extended error code %ld."),
TEXT("Microsoft Windows Network"), dwError, dwLastError);
wsprintf (szCaption, TEXT("%s error"), lpszFunction);
MessageBox (hwnd, szError, szCaption, MB_OK);
return TRUE;
}
See Also
Concepts
Retrieving Network Data
Windows Networking API/Redirector Application Development
Managing Network Connections with WNet