1 // MyMessages.cpp
2
3 #include "StdAfx.h"
4
5 #include "MyMessages.h"
6
7 #include "../../../Windows/ErrorMsg.h"
8 #include "../../../Windows/ResourceString.h"
9
10 #include "../FileManager/LangUtils.h"
11
12 using namespace NWindows;
13
ShowErrorMessage(HWND window,LPCWSTR message)14 void ShowErrorMessage(HWND window, LPCWSTR message)
15 {
16 ::MessageBoxW(window, message, L"7-Zip", MB_OK | MB_ICONSTOP);
17 }
18
ShowErrorMessageHwndRes(HWND window,UINT resID)19 void ShowErrorMessageHwndRes(HWND window, UINT resID)
20 {
21 UString s = LangString(resID);
22 if (s.IsEmpty())
23 s.Add_UInt32(resID);
24 ShowErrorMessage(window, s);
25 }
26
ShowErrorMessageRes(UINT resID)27 void ShowErrorMessageRes(UINT resID)
28 {
29 ShowErrorMessageHwndRes(NULL, resID);
30 }
31
ShowErrorMessageDWORD(HWND window,DWORD errorCode)32 static void ShowErrorMessageDWORD(HWND window, DWORD errorCode)
33 {
34 ShowErrorMessage(window, NError::MyFormatMessage(errorCode));
35 }
36
ShowLastErrorMessage(HWND window)37 void ShowLastErrorMessage(HWND window)
38 {
39 ShowErrorMessageDWORD(window, ::GetLastError());
40 }
41