Commit bd2734d9 authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

wordpad: Show error message if saving fails.

parent e3efa88c
......@@ -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
......@@ -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
......@@ -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))
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment