Windows Native Toolkit

Message Box Library

Native Windows message-box and task-dialog nodes with synchronous and async variants.

Use this library for confirmations, diagnostics, launchers, setup prompts, and native modal dialogs.

Python examples use Unreal's reflected API names through the unreal module. Async action variants are intentionally left as C++-only examples because they are not practical to drive from Unreal Python.

Show Native Message Box

Shows a standard Windows message box immediately.

PinDirectionPurpose
TitleInputDialog window title.
MessageInputMain message text.
ButtonsInputStandard Windows button layout.
IconInputOptional native icon style.
ConfirmedOutputFires when the player clicks OK or Yes.
DeclinedOutputFires when the player clicks No.
CanceledOutputFires when the player cancels or closes the dialog.
C++ Example
#include "MessageBoxWindows.h"

EMessageBoxResult Result = EMessageBoxResult::Canceled;
UNativeMessageBox::ShowNativeMessageBox(
    TEXT("Confirm"),
    TEXT("Continue?"),
    EMessageBoxButtons::YesNoCancel,
    EWNTMessageBoxIcon::Question,
    Result
);
Python Example
import unreal

result = unreal.NativeMessageBox.show_native_message_box(
    "Confirm",
    "Continue?",
    unreal.MessageBoxButtons.YES_NO_CANCEL,
    unreal.WNTMessageBoxIcon.QUESTION,
)

Show Native Message Box Async

Shows the same Windows message box on a worker thread and keeps Blueprint flow responsive.

PinDirectionPurpose
WorldContextObjectInputAsync action registration context.
TitleInputDialog window title.
MessageInputMain message text.
ButtonsInputStandard Windows button layout.
IconInputOptional native icon style.
ThenOutputContinues immediately after the async action is created.
On ConfirmedOutputFires when the player clicks OK or Yes.
On DeclinedOutputFires when the player clicks No.
On CanceledOutputFires when the player cancels or closes the dialog.
C++ Example
#include "MessageBoxWindows.h"

UFUNCTION()
void HandleDialogConfirmed();

UFUNCTION()
void HandleDialogDeclined();

UFUNCTION()
void HandleDialogCanceled();

UAsyncNativeMessageBoxAction* Action =
    UAsyncNativeMessageBoxAction::ShowNativeMessageBoxAsync(
        this,
        TEXT("Confirm"),
        TEXT("Continue?"),
        EMessageBoxButtons::YesNoCancel,
        EWNTMessageBoxIcon::Question);

Action->OnConfirmed.AddDynamic(this, &UMyObject::HandleDialogConfirmed);
Action->OnDeclined.AddDynamic(this, &UMyObject::HandleDialogDeclined);
Action->OnCanceled.AddDynamic(this, &UMyObject::HandleDialogCanceled);

Show Regular Message Box

Shows the custom native task-dialog version with your own button text.

PinDirectionPurpose
TitleInputDialog window title.
MessageInputMain message text.
IconInputOptional native icon style.
FirstButtonTextInputText shown on the primary button.
SecondButtonTextInputText shown on the secondary button.
bShowSecondButtonInputControls whether the second button is shown.
First Button ClickedOutputFires when the primary button is chosen.
Second Button / CancelOutputFires when the second button is chosen or the dialog is canceled.
C++ Example
#include "MessageBoxWindows.h"

ECustomDialogResult Result = ECustomDialogResult::SecondButton;
UNativeMessageBox::ShowMessageBox(
    TEXT("Install"),
    TEXT("Start installation now?"),
    EWNTMessageBoxIcon::Information,
    TEXT("Start"),
    TEXT("Later"),
    true,
    Result
);
Python Example
import unreal

result = unreal.NativeMessageBox.show_message_box(
    "Install",
    "Start installation now?",
    unreal.WNTMessageBoxIcon.INFORMATION,
    "Start",
    "Later",
    True,
)

Show Regular Message Box Async

Shows the custom task dialog asynchronously.

PinDirectionPurpose
WorldContextObjectInputAsync action registration context.
TitleInputDialog window title.
MessageInputMain message text.
IconInputOptional native icon style.
FirstButtonTextInputText shown on the primary button.
SecondButtonTextInputText shown on the secondary button.
bShowSecondButtonInputControls whether the second button is shown.
ThenOutputContinues immediately after the async action is created.
On First ButtonOutputFires when the primary button is chosen.
On Second ButtonOutputFires when the secondary button is chosen or the dialog is canceled.
C++ Example
#include "MessageBoxWindows.h"

UFUNCTION()
void HandlePrimaryDialogButton();

UFUNCTION()
void HandleSecondaryDialogButton();

UAsyncRegularMessageBoxAction* Action =
    UAsyncRegularMessageBoxAction::ShowMessageBoxAsync(
        this,
        TEXT("Install"),
        TEXT("Start installation now?"),
        EWNTMessageBoxIcon::Information,
        TEXT("Start"),
        TEXT("Later"),
        true);

Action->OnFirstButton.AddDynamic(this, &UMyObject::HandlePrimaryDialogButton);
Action->OnSecondButton.AddDynamic(this, &UMyObject::HandleSecondaryDialogButton);

Last updated on

On this page