Skip to content

Commit

Permalink
Add Platform.MessageBoxInfo/MessageBoxError
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Apr 11, 2024
1 parent 2ac05f2 commit d6da84f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Bindings/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

}
10 changes: 10 additions & 0 deletions src/Dotx64Managed/API/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit d6da84f

Please sign in to comment.