From d6da84f83999c8959b934208a61a0478e0da700e Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 11 Apr 2024 19:36:53 +0200 Subject: [PATCH] Add Platform.MessageBoxInfo/MessageBoxError --- src/Bindings/Platform.cpp | 14 ++++++++++++++ src/Dotx64Managed/API/Platform.cs | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Bindings/Platform.cpp b/src/Bindings/Platform.cpp index f4ad97f..205651d 100644 --- a/src/Bindings/Platform.cpp +++ b/src/Bindings/Platform.cpp @@ -132,6 +132,20 @@ namespace Dotx64Dbg::Native { SetClipboardData(CF_UNICODETEXT, hMem); CloseClipboard(); } + + static void MessageBoxInfo(System::String^ text, System::String^ title) + { + const auto textStr = interop::toUTF16(text); + const auto titleStr = title ? interop::toUTF16(title) : L"Information"; + MessageBoxW(GuiGetWindowHandle(), textStr.c_str(), titleStr.c_str(), MB_ICONINFORMATION); + } + + static void MessageBoxError(System::String^ text, System::String^ title) + { + const auto textStr = interop::toUTF16(text); + const auto titleStr = title ? interop::toUTF16(title) : L"Error"; + MessageBoxW(GuiGetWindowHandle(), textStr.c_str(), titleStr.c_str(), MB_ICONERROR); + } }; } diff --git a/src/Dotx64Managed/API/Platform.cs b/src/Dotx64Managed/API/Platform.cs index f0ec237..651dc10 100644 --- a/src/Dotx64Managed/API/Platform.cs +++ b/src/Dotx64Managed/API/Platform.cs @@ -22,5 +22,15 @@ public static void SetClipboardText(string text) { Native.Platform.SetClipboardText(text); } + + public static void MessageBoxInfo(string text, string title = null) + { + Native.Platform.MessageBoxInfo(text, title); + } + + public static void MessageBoxError(string text, string title = null) + { + Native.Platform.MessageBoxError(text, title); + } } }