Skip to content

Commit 5073dfa

Browse files
committed
Fix messagebox window handle check
1 parent f4e988d commit 5073dfa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

phlib/util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ INT PhShowMessage2(
455455
if (!message)
456456
return -1;
457457

458-
config.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION | (IsWindowVisible(hWnd) ? TDF_POSITION_RELATIVE_TO_WINDOW : 0);
458+
config.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION | ((hWnd && IsWindowVisible(hWnd)) ? TDF_POSITION_RELATIVE_TO_WINDOW : 0) | TDF_SIZE_TO_CONTENT;
459459
config.dwCommonButtons = Buttons;
460460
config.hwndParent = hWnd;
461461
config.pszWindowTitle = PhApplicationName;
@@ -628,7 +628,7 @@ BOOLEAN PhShowConfirmMessage(
628628

629629
config.hwndParent = hWnd;
630630
config.hInstance = PhInstanceHandle;
631-
config.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION | (IsWindowVisible(hWnd) ? TDF_POSITION_RELATIVE_TO_WINDOW : 0);
631+
config.dwFlags = TDF_ALLOW_DIALOG_CANCELLATION | ((hWnd && IsWindowVisible(hWnd)) ? TDF_POSITION_RELATIVE_TO_WINDOW : 0);
632632
config.pszWindowTitle = PhApplicationName;
633633
config.pszMainIcon = Warning ? TD_WARNING_ICON : TD_INFORMATION_ICON;
634634
config.pszMainInstruction = PhaConcatStrings(3, L"Do you want to ", action->Buffer, L"?")->Buffer;

0 commit comments

Comments
 (0)