From 90c7bc237c9cf964c16f0cb48c308a92a8193a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 2 Sep 2022 02:11:49 +0200 Subject: Use global Window object. This makes it easier to control initialization and maintain RAII. --- c/win.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'c/win.cpp') diff --git a/c/win.cpp b/c/win.cpp index e1349bc..40d68e4 100644 --- a/c/win.cpp +++ b/c/win.cpp @@ -4,6 +4,7 @@ #include #include +#include "main.h" #include "util.h" #include "win.h" @@ -86,9 +87,9 @@ static void CenterNextWindow(HWND hWnd) int EBMessageBox(const std::wstring_view text, const std::wstring_view caption, const UINT uType) { - extern HWND g_hWnd; - CenterNextWindow(g_hWnd); - return MessageBox(g_hWnd, text.data(), caption.data(), uType); + extern Window* g_window; + CenterNextWindow(g_window->hWnd); + return MessageBox(g_window->hWnd, text.data(), caption.data(), uType); } void ShowException(const wchar_t* const fmt, const wchar_t* const title, const UINT uType) noexcept -- cgit v1.2.3