[英]TaskDialogIndirect randomly fails and makes empty, undrendered window
I use TaskDialogIndirect()
to display more advanced Error Messages.我使用
TaskDialogIndirect()
来显示更高级的错误消息。 I can customize the buttons, icons, and more.我可以自定义按钮、图标等。
The problem is that, sometimes it makes these invisible empty dialog boxes.问题是,有时它会使这些不可见的空对话框。
I need it to be reliable.我需要它是可靠的。 I am wondering why this is even happening in the first place.
我想知道为什么这甚至会发生在首位。
Example of it failing (there is no visible window):它失败的例子(没有可见的窗口):
Here is the code that makes the dialogs (not production code):这是制作对话框的代码(不是生产代码):
int MessageBoxPosL(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType, int X, int Y)
{
TaskDialogData data;
data.X = X;
data.Y = Y;
TASKDIALOGCONFIG config = {};
config.cbSize = sizeof(config);
config.hwndParent = hWnd;
config.pszWindowTitle = lpCaption;
config.pszContent = lpText;
// configure other settings as desired, based on uType...
config.pfCallback = &TaskDialogCallback;
config.lpCallbackData = (LONG_PTR)&data;
config.dwFlags = TDF_ENABLE_HYPERLINKS;
config.hFooterIcon = LoadIcon(NULL, IDI_ERROR);
config.dwCommonButtons = ButtonActive(TDCBF_YES_BUTTON) | ButtonActive(TDCBF_NO_BUTTON) | ButtonActive(TDCBF_OK_BUTTON) | ButtonActive(TDCBF_RETRY_BUTTON) | ButtonActive(TDCBF_CLOSE_BUTTON);
config.pszMainIcon = SetIcon();
int button = 0;
TaskDialogIndirect(&config, &button, NULL, NULL);
return button;
}
The problem was the flag TDF_ENABLE_HYPERLINKS.问题是标志 TDF_ENABLE_HYPERLINKS。 Adding hyperlinked text that is too long caused the dialog to spawn outside of the desktop view.
添加太长的超链接文本会导致对话框在桌面视图之外生成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.