From 63b3dc58be6a03cd617668f3a1a97cbfb3f95438 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 26 Apr 2006 00:05:09 +0000 Subject: [PATCH] document that the workaround used to make popup menus behave correctly is the one officially sanctioned by Microsoft and provide the URL to the Knowledge Base article; also minor cleanup: use GetHwndOf() instead of HWND casts git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/taskbar.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index ec0f9b717b..503480beae 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -147,7 +147,7 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) m_icon = icon; m_strTooltip = tooltip; - NotifyIconData notifyData((HWND)m_win->GetHWND()); + NotifyIconData notifyData(GetHwndOf(m_win)); if (icon.Ok()) { @@ -178,7 +178,7 @@ bool wxTaskBarIcon::RemoveIcon() m_iconAdded = false; - NotifyIconData notifyData((HWND)m_win->GetHWND()); + NotifyIconData notifyData(GetHwndOf(m_win)); return Shell_NotifyIcon(NIM_DELETE, ¬ifyData) != 0; } @@ -203,13 +203,14 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) menu->UpdateUI(); - // Work around a WIN32 bug - ::SetForegroundWindow((HWND)m_win->GetHWND()); + // the SetForegroundWindow() and PostMessage() calls are needed to work + // around Win32 bug with the popup menus shown for the notifications as + // documented at http://support.microsoft.com/kb/q135788/ + ::SetForegroundWindow(GetHwndOf(m_win)); bool rval = m_win->PopupMenu(menu, 0, 0); - // Work around a WIN32 bug - ::PostMessage((HWND)m_win->GetHWND(), WM_NULL, 0, 0L); + ::PostMessage(GetHwndOf(m_win), WM_NULL, 0, 0L); m_win->PopEventHandler(false); -- 2.45.2