Add popup creation null check with diagnostic MessageBox

This commit is contained in:
Win Dictation Dev
2026-06-11 17:41:34 +12:00
parent dd25b2f58b
commit 02581c0c27
+6
View File
@@ -698,6 +698,12 @@ void ShowSelectPopup(HWND owner, int ctrlId, const std::vector<std::wstring>& it
int h = (int)items.size() * 30 + 6, wdt = (int)anchor.Width; int h = (int)items.size() * 30 + 6, wdt = (int)anchor.Width;
HWND p = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, L"DictPopup", L"", HWND p = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, L"DictPopup", L"",
WS_POPUP, tl.x, tl.y + 2, wdt, h, owner, nullptr, hInst, nullptr); WS_POPUP, tl.x, tl.y + 2, wdt, h, owner, nullptr, hInst, nullptr);
if (!p) {
wchar_t dbg[128];
swprintf_s(dbg, L"Popup failed: w=%d h=%d x=%d y=%d err=%d", wdt, h, tl.x, tl.y, GetLastError());
MessageBoxW(owner, dbg, L"Popup Error", MB_OK);
return;
}
int corner = DWMWCP_ROUND; DwmSetWindowAttribute(p, DWMWA_WINDOW_CORNER_PREFERENCE, &corner, sizeof(corner)); int corner = DWMWCP_ROUND; DwmSetWindowAttribute(p, DWMWA_WINDOW_CORNER_PREFERENCE, &corner, sizeof(corner));
ShowWindow(p, SW_SHOWNA); SetFocus(p); ShowWindow(p, SW_SHOWNA); SetFocus(p);
} }