xref: /aosp_15_r20/external/lzma/CPP/7zip/UI/Explorer/MyMessages.cpp (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
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 
14 extern bool g_DisableUserQuestions;
15 
ShowErrorMessage(HWND window,LPCWSTR message)16 void ShowErrorMessage(HWND window, LPCWSTR message)
17 {
18   if (!g_DisableUserQuestions)
19     ::MessageBoxW(window, message, L"7-Zip", MB_OK | MB_ICONSTOP);
20 }
21 
ShowErrorMessageHwndRes(HWND window,UInt32 resID)22 void ShowErrorMessageHwndRes(HWND window, UInt32 resID)
23 {
24   UString s = LangString(resID);
25   if (s.IsEmpty())
26     s.Add_UInt32(resID);
27   ShowErrorMessage(window, s);
28 }
29 
ShowErrorMessageRes(UInt32 resID)30 void ShowErrorMessageRes(UInt32 resID)
31 {
32   ShowErrorMessageHwndRes(NULL, resID);
33 }
34 
ShowErrorMessageDWORD(HWND window,DWORD errorCode)35 static void ShowErrorMessageDWORD(HWND window, DWORD errorCode)
36 {
37   ShowErrorMessage(window, NError::MyFormatMessage(errorCode));
38 }
39 
ShowLastErrorMessage(HWND window)40 void ShowLastErrorMessage(HWND window)
41 {
42   ShowErrorMessageDWORD(window, ::GetLastError());
43 }
44