From aea5b1c1bda2cee29d8428028d81272ae9fa048d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 21 Dec 2008 01:43:56 +0000 Subject: [PATCH] add wxLogLastError() calls if Shell_NotifyIcon() fails (closes #10222) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/taskbar.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index 856b6c1911..0d7dd2a119 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -203,6 +203,11 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY : NIM_ADD, ¬ifyData) != 0; + if ( !ok ) + { + wxLogLastError(wxT("wxShellNotifyIcon(NIM_MODIFY/ADD)")); + } + if ( !m_iconAdded && ok ) m_iconAdded = true; @@ -228,8 +233,10 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, notifyData.uFlags = 0; notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows XP */; - wxShellNotifyIcon(NIM_SETVERSION, ¬ifyData); - + if ( !wxShellNotifyIcon(NIM_SETVERSION, ¬ifyData) ) + { + wxLogLastError(wxT("wxShellNotifyIcon(NIM_SETVERSION)")); + } // do show the balloon now notifyData = NotifyIconData(hwnd); @@ -246,7 +253,13 @@ wxTaskBarIcon::ShowBalloon(const wxString& title, else if ( flags & wxICON_ERROR ) notifyData.dwInfoFlags |= NIIF_ERROR; - return wxShellNotifyIcon(NIM_MODIFY, ¬ifyData) != 0; + bool ok = wxShellNotifyIcon(NIM_MODIFY, ¬ifyData) != 0; + if ( !ok ) + { + wxLogLastError(wxT("wxShellNotifyIcon(NIM_MODIFY)")); + } + + return ok; } #endif // wxUSE_TASKBARICON_BALLOONS @@ -260,7 +273,13 @@ bool wxTaskBarIcon::RemoveIcon() NotifyIconData notifyData(GetHwndOf(m_win)); - return wxShellNotifyIcon(NIM_DELETE, ¬ifyData) != 0; + bool ok = wxShellNotifyIcon(NIM_DELETE, ¬ifyData) != 0; + if ( !ok ) + { + wxLogLastError(wxT("wxShellNotifyIcon(NIM_DELETE)")); + } + + return ok; } #if wxUSE_MENUS