+#if wxUSE_TASKBARICON_BALLOONS
+
+bool
+wxTaskBarIcon::ShowBalloon(const wxString& title,
+ const wxString& text,
+ unsigned msec,
+ int flags)
+{
+ wxCHECK_MSG( m_iconAdded, false,
+ _T("can't be used before the icon is created") );
+
+ const HWND hwnd = GetHwndOf(m_win);
+
+ // we need to enable version 5.0 behaviour to receive notifications about
+ // the balloon disappearance
+ NotifyIconData notifyData(hwnd);
+ notifyData.uFlags = 0;
+ notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows XP */;
+
+ if ( !wxShellNotifyIcon(NIM_SETVERSION, ¬ifyData) )
+ {
+ wxLogLastError(wxT("wxShellNotifyIcon(NIM_SETVERSION)"));
+ }
+
+ // do show the balloon now
+ notifyData = NotifyIconData(hwnd);
+ notifyData.uFlags |= NIF_INFO;
+ notifyData.uTimeout = msec;
+ wxStrlcpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo));
+ wxStrlcpy(notifyData.szInfoTitle, title.wx_str(),
+ WXSIZEOF(notifyData.szInfoTitle));
+
+ if ( flags & wxICON_INFORMATION )
+ notifyData.dwInfoFlags |= NIIF_INFO;
+ else if ( flags & wxICON_WARNING )
+ notifyData.dwInfoFlags |= NIIF_WARNING;
+ else if ( flags & wxICON_ERROR )
+ notifyData.dwInfoFlags |= NIIF_ERROR;
+
+ bool ok = wxShellNotifyIcon(NIM_MODIFY, ¬ifyData) != 0;
+ if ( !ok )
+ {
+ wxLogLastError(wxT("wxShellNotifyIcon(NIM_MODIFY)"));
+ }
+
+ return ok;
+}
+
+#endif // wxUSE_TASKBARICON_BALLOONS
+