[ui] report errors to the user

* added StrErr() call
* also improved WindowsErrorString() and Notification() calls
This commit is contained in:
Pete Batard 2011-12-04 19:47:27 +00:00
parent 5a001f40f4
commit 5065c02d63
6 changed files with 102 additions and 29 deletions

14
stdlg.c
View file

@ -512,10 +512,17 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
/*
* Display a custom notification
*/
void Notification(int type, char* text, char* title)
BOOL Notification(int type, char* title, char* format, ...)
{
szMessageText = text;
va_list args;
szMessageText = (char*)malloc(MAX_PATH);
if (szMessageText == NULL) return FALSE;
szMessageTitle = title;
va_start(args, format);
safe_vsnprintf(szMessageText, MAX_PATH-1, format, args);
va_end(args);
szMessageText[MAX_PATH-1] = 0;
switch(type) {
case MSG_WARNING:
hMessageIcon = LoadIcon(NULL, IDI_WARNING);
@ -529,7 +536,8 @@ void Notification(int type, char* text, char* title)
break;
}
DialogBox(hMainInstance, MAKEINTRESOURCE(IDD_NOTIFICATION), hMainDialog, NotificationCallback);
szMessageText = NULL;
safe_free(szMessageText);
return TRUE;
}
struct {