Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 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
Windows Networking API/Redirector Application Development | Managing Network Connections with WNet | Retrieving Network Data
Send Feedback on this topic to the authors