add wxLogLastError() calls if Shell_NotifyIcon() fails (closes #10222)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Dec 2008 01:43:56 +0000 (01:43 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Dec 2008 01:43:56 +0000 (01:43 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/taskbar.cpp

index 856b6c1911bec6c5d1a2fb35ef1109586bfb52a2..0d7dd2a119f086b2ce8b854eef43703808b18e2c 100644 (file)
@@ -203,6 +203,11 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
     bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY
                                             : NIM_ADD, &notifyData) != 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, &notifyData);
-
+    if ( !wxShellNotifyIcon(NIM_SETVERSION, &notifyData) )
+    {
+        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, &notifyData) != 0;
+    bool ok = wxShellNotifyIcon(NIM_MODIFY, &notifyData) != 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, &notifyData) != 0;
+    bool ok = wxShellNotifyIcon(NIM_DELETE, &notifyData) != 0;
+    if ( !ok )
+    {
+        wxLogLastError(wxT("wxShellNotifyIcon(NIM_DELETE)"));
+    }
+
+    return ok;
 }
 
 #if wxUSE_MENUS