1370b324cSopenharmony_ci// MyMessages.cpp
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#include "StdAfx.h"
4370b324cSopenharmony_ci
5370b324cSopenharmony_ci#include "MyMessages.h"
6370b324cSopenharmony_ci
7370b324cSopenharmony_ci#include "../../../Windows/ErrorMsg.h"
8370b324cSopenharmony_ci#include "../../../Windows/ResourceString.h"
9370b324cSopenharmony_ci
10370b324cSopenharmony_ci#include "../FileManager/LangUtils.h"
11370b324cSopenharmony_ci
12370b324cSopenharmony_ciusing namespace NWindows;
13370b324cSopenharmony_ci
14370b324cSopenharmony_civoid ShowErrorMessage(HWND window, LPCWSTR message)
15370b324cSopenharmony_ci{
16370b324cSopenharmony_ci  ::MessageBoxW(window, message, L"7-Zip", MB_OK | MB_ICONSTOP);
17370b324cSopenharmony_ci}
18370b324cSopenharmony_ci
19370b324cSopenharmony_civoid ShowErrorMessageHwndRes(HWND window, UINT resID)
20370b324cSopenharmony_ci{
21370b324cSopenharmony_ci  UString s = LangString(resID);
22370b324cSopenharmony_ci  if (s.IsEmpty())
23370b324cSopenharmony_ci    s.Add_UInt32(resID);
24370b324cSopenharmony_ci  ShowErrorMessage(window, s);
25370b324cSopenharmony_ci}
26370b324cSopenharmony_ci
27370b324cSopenharmony_civoid ShowErrorMessageRes(UINT resID)
28370b324cSopenharmony_ci{
29370b324cSopenharmony_ci  ShowErrorMessageHwndRes(NULL, resID);
30370b324cSopenharmony_ci}
31370b324cSopenharmony_ci
32370b324cSopenharmony_cistatic void ShowErrorMessageDWORD(HWND window, DWORD errorCode)
33370b324cSopenharmony_ci{
34370b324cSopenharmony_ci  ShowErrorMessage(window, NError::MyFormatMessage(errorCode));
35370b324cSopenharmony_ci}
36370b324cSopenharmony_ci
37370b324cSopenharmony_civoid ShowLastErrorMessage(HWND window)
38370b324cSopenharmony_ci{
39370b324cSopenharmony_ci  ShowErrorMessageDWORD(window, ::GetLastError());
40370b324cSopenharmony_ci}
41