If "detail" is empty then don't make message hilighted

This commit is contained in:
Cheng Zhao 2015-07-08 14:41:19 +08:00
parent 49da74f976
commit f0be4025a5

View file

@ -31,20 +31,26 @@ int ShowMessageBoxUTF16(HWND parent,
for (size_t i = 0; i < buttons.size(); ++i) for (size_t i = 0; i < buttons.size(); ++i)
dialog_buttons.push_back({i + kIDStart, buttons[i].c_str()}); dialog_buttons.push_back({i + kIDStart, buttons[i].c_str()});
TASKDIALOG_FLAGS flags = TDF_SIZE_TO_CONTENT; TASKDIALOG_FLAGS flags = TDF_SIZE_TO_CONTENT; // show all content.
if (cancel_id != 0) if (cancel_id != 0)
flags |= TDF_ALLOW_DIALOG_CANCELLATION; flags |= TDF_ALLOW_DIALOG_CANCELLATION; // allow dialog to be cancelled.
TASKDIALOGCONFIG config = { 0 }; TASKDIALOGCONFIG config = { 0 };
config.cbSize = sizeof(config); config.cbSize = sizeof(config);
config.hwndParent = parent; config.hwndParent = parent;
config.hInstance = GetModuleHandle(NULL); config.hInstance = GetModuleHandle(NULL);
config.dwFlags = flags; config.dwFlags = flags;
config.pszWindowTitle = title.c_str(); config.pszWindowTitle = title.c_str();
config.pszMainInstruction = message.c_str(); config.pButtons = &dialog_buttons.front();
config.pszContent = detail.c_str(); config.cButtons = dialog_buttons.size();
config.pButtons = &dialog_buttons.front();
config.cButtons = dialog_buttons.size(); // If "detail" is empty then don't make message hilighted.
if (detail.empty()) {
config.pszContent = message.c_str();
} else {
config.pszMainInstruction = message.c_str();
config.pszContent = detail.c_str();
}
int id = 0; int id = 0;
TaskDialogIndirect(&config, &id, NULL, NULL); TaskDialogIndirect(&config, &id, NULL, NULL);