-
Notifications
You must be signed in to change notification settings - Fork 961
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f281c8
commit 70f42c6
Showing
5 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <Windows.h> | ||
|
||
#include "WindowsDynamicLibrary.h" | ||
|
||
class WindowsMessageBox { | ||
public: | ||
void showWarning(const char* title, const char* message) const noexcept | ||
{ | ||
showMessageBox(title, message, MB_ICONWARNING); | ||
} | ||
|
||
void showError(const char* title, const char* message) const noexcept | ||
{ | ||
showMessageBox(title, message, MB_ICONERROR); | ||
} | ||
|
||
private: | ||
void showMessageBox(const char* title, const char* message, unsigned int extraFlags) const noexcept | ||
{ | ||
if (messageBoxA) | ||
messageBoxA(nullptr, message, title, MB_OK | extraFlags); | ||
} | ||
|
||
decltype(&MessageBoxA) messageBoxA = WindowsDynamicLibrary{ "USER32.dll" }.getFunctionAddress("MessageBoxA").as<decltype(&MessageBoxA)>(); | ||
}; |