Index: base/applications/mplay32/mplay32.c =================================================================== --- base/applications/mplay32/mplay32.c (revision 62092) +++ base/applications/mplay32/mplay32.c (working copy) @@ -102,6 +102,18 @@ } static VOID +ShowLastWin32Error(HWND hwnd) +{ + DWORD dwError; + LPTSTR lpMessageBuffer; + + dwError= GetLastError(); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPWSTR)&lpMessageBuffer, 0, NULL); + MessageBox(hwnd, lpMessageBuffer, szAppTitle, MB_OK | MB_ICONERROR); + LocalFree(lpMessageBuffer); +} + +static VOID ShowMCIError(HWND hwnd, DWORD dwError) { TCHAR szErrorMessage[256]; @@ -138,7 +150,7 @@ NULL); if (!hTrackBar) { - MessageBox(hwnd, _T("TrackBar it is not created!"), NULL, MB_OK); + ShowLastWin32Error(hwnd); return; } @@ -158,7 +170,7 @@ NULL); if (!hToolBar) { - MessageBox(hwnd, _T("ToolBar it is not created!"), NULL, MB_OK); + ShowLastWin32Error(hwnd); return; } @@ -743,7 +755,11 @@ WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); WndClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU); - RegisterClassEx(&WndClass); + if (!RegisterClassEx(&WndClass)) + { + ShowLastWin32Error(0); + return 0; + } hwnd = CreateWindow(szClassName, szAppTitle, @@ -757,6 +773,12 @@ hInstance, NULL); + if (!hwnd) + { + ShowLastWin32Error(0); + return 0; + } + DragAcceptFiles(hwnd, TRUE); DisableMenuItems(); @@ -780,5 +802,5 @@ DispatchMessage(&msg); } - return 0; + return (int) msg.wParam; }