diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc index 87f5a97f007..d1a84730edc 100644 --- a/programs/wordpad/En.rc +++ b/programs/wordpad/En.rc @@ -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 diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc index 411e58aef94..f73b14597ca 100644 --- a/programs/wordpad/No.rc +++ b/programs/wordpad/No.rc @@ -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 diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index 6f3e41aa989..20fa60c8a1c 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -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)) { diff --git a/programs/wordpad/wordpad.h b/programs/wordpad/wordpad.h index 53a6c1378a9..c5305bb8088 100644 --- a/programs/wordpad/wordpad.h +++ b/programs/wordpad/wordpad.h @@ -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);