Add check for TaskDialogIndirect
@@ -695,9 +695,6 @@ BOOLEAN PhShowConfirmMessage(
PPH_STRING verb;
PPH_STRING verbCaps;
PPH_STRING action;
- TASKDIALOGCONFIG config = { sizeof(config) };
- TASKDIALOG_BUTTON buttons[2];
- INT button;
// Make sure the verb is all lowercase.
verb = PhaLowerString(PhaCreateString(Verb));
@@ -709,15 +706,19 @@ BOOLEAN PhShowConfirmMessage(
// "terminate", "the process" -> "terminate the process"
action = PhaConcatStrings(3, verb->Buffer, L" ", Object);
+ if (TaskDialogIndirect)
+ {
+ TASKDIALOGCONFIG config = { sizeof(TASKDIALOGCONFIG) };
+ TASKDIALOG_BUTTON buttons[2];
+ INT button;
+
config.hwndParent = hWnd;
config.hInstance = PhInstanceHandle;
config.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION | ((hWnd && IsWindowVisible(hWnd) && !IsMinimized(hWnd)) ? TDF_POSITION_RELATIVE_TO_WINDOW : 0);
config.pszWindowTitle = PhApplicationName;
config.pszMainIcon = Warning ? TD_WARNING_ICON : TD_INFORMATION_ICON;
config.pszMainInstruction = PhaConcatStrings(3, L"Do you want to ", action->Buffer, L"?")->Buffer;
-
- if (Message)
- config.pszContent = PhaConcatStrings2(Message, L" Are you sure you want to continue?")->Buffer;
+ if (Message) config.pszContent = PhaConcatStrings2(Message, L" Are you sure you want to continue?")->Buffer;
buttons[0].nButtonID = IDYES;
buttons[0].pszButtonText = verbCaps->Buffer;
@@ -742,6 +743,16 @@ BOOLEAN PhShowConfirmMessage(
return FALSE;
}
}
+ else
+ {
+ return PhShowMessage(
+ hWnd,
+ MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2,
+ L"Are you sure you want to %s?",
+ action->Buffer
+ ) == IDYES;
+ }
+}
/**
* Finds an integer in an array of string-integer pairs.
