diff --git a/src/msw/window.cpp b/src/msw/window.cpp index b7552a3d6c..56c4913473 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2982,10 +2982,16 @@ bool wxWindow::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) return popupMenu->MSWCommand(cmd, id); } - // must cast to a signed type before comparing with other ids! - wxWindow *win = FindItem((signed short)id); - if ( !win ) + wxWindow *win; + if ( cmd == 0 || cmd == 1 ) // menu or accel - use id { + // must cast to a signed type before comparing with other ids! + win = FindItem((signed short)id); + } + else + { + // find it from HWND - this works even with the broken programs using + // the same ids for different controls win = wxFindWinFromHandle(control); }