From 50f226e34e3a8c27628b62890f9075eb137312c2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 4 Aug 2015 21:56:17 +0800 Subject: [PATCH] win: Use app name as default title of message box TaskDialogIndirect doesn't allow empty name, if we set empty title it will show "electron.exe" in title. --- atom/browser/ui/message_box_win.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/atom/browser/ui/message_box_win.cc b/atom/browser/ui/message_box_win.cc index 58d1badc3bfd..051f8f5eff6c 100644 --- a/atom/browser/ui/message_box_win.cc +++ b/atom/browser/ui/message_box_win.cc @@ -10,6 +10,7 @@ #include #include +#include "atom/browser/browser.h" #include "atom/browser/native_window_views.h" #include "base/callback.h" #include "base/strings/string_util.h" @@ -87,7 +88,12 @@ int ShowMessageBoxUTF16(HWND parent, config.hInstance = GetModuleHandle(NULL); config.dwFlags = flags; - if (!title.empty()) + // TaskDialogIndirect doesn't allow empty name, if we set empty title it + // will show "electron.exe" in title. + base::string16 app_name = base::UTF8ToUTF16(Browser::Get()->GetName()); + if (title.empty()) + config.pszWindowTitle = app_name.c_str(); + else config.pszWindowTitle = title.c_str(); base::win::ScopedHICON hicon;