wordpad: Show error message if saving fails.

This commit is contained in:
Alexander Nicolaysen Sørnes 2008-07-11 20:38:50 +02:00 committed by Alexandre Julliard
parent e3efa88c45
commit bd2734d9c6
4 changed files with 25 additions and 0 deletions

View file

@ -234,4 +234,6 @@ BEGIN
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
STRING_WRITE_FAILED, "Could not save the file."
STRING_WRITE_ACCESS_DENIED, "You do not have access to save the file."
END

View file

@ -234,4 +234,6 @@ BEGIN
"sikker på at du vil fortsette?"
STRING_INVALID_NUMBER, "Ugyldig tallformat"
STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
STRING_WRITE_FAILED, "Klarte ikke lagre filen."
STRING_WRITE_ACCESS_DENIED, "Du har ikke tilgang til å lagre filen."
END

View file

@ -753,6 +753,22 @@ static void DoOpenFile(LPCWSTR szOpenFileName)
update_font_list();
}
static void ShowWriteError(DWORD Code)
{
LPWSTR Message;
switch(Code)
{
case ERROR_ACCESS_DENIED:
Message = MAKEINTRESOURCEW(STRING_WRITE_ACCESS_DENIED);
break;
default:
Message = MAKEINTRESOURCEW(STRING_WRITE_FAILED);
}
MessageBoxW(hMainWnd, Message, wszAppTitle, MB_ICONEXCLAMATION | MB_OK);
}
static void DoSaveFile(LPCWSTR wszSaveFileName, WPARAM format)
{
HANDLE hFile;
@ -763,7 +779,10 @@ static void DoSaveFile(LPCWSTR wszSaveFileName, WPARAM format)
FILE_ATTRIBUTE_NORMAL, NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
ShowWriteError(GetLastError());
return;
}
if(format == (SF_TEXT | SF_UNICODE))
{

View file

@ -193,6 +193,8 @@
#define STRING_SAVE_LOSEFORMATTING 1704
#define STRING_INVALID_NUMBER 1705
#define STRING_OLE_STORAGE_NOT_SUPPORTED 1706
#define STRING_WRITE_FAILED 1707
#define STRING_WRITE_ACCESS_DENIED 1708
LPWSTR file_basename(LPWSTR);