From: Vadim Zeitlin Date: Wed, 13 Dec 2000 16:18:26 +0000 (+0000) Subject: fix for MSWDetachWindowMenu when "&Window" string is translated X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/aa44b2611555154a92fb02c9193eed599319bea4 fix for MSWDetachWindowMenu when "&Window" string is translated git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 12df591053..4193250a77 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2304,15 +2304,13 @@ void wxWindow::MSWDetachWindowMenu() { if ( m_hMenu ) { + wxChar buf[1024]; HMENU hMenu = (HMENU)m_hMenu; int N = ::GetMenuItemCount(hMenu); - int i; - for (i = 0; i < N; i++) + for ( int i = 0; i < N; i++ ) { - wxChar buf[100]; - int chars = GetMenuString(hMenu, i, buf, 100, MF_BYPOSITION); - if ( !chars ) + if ( !::GetMenuString(hMenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION) ) { wxLogLastError(wxT("GetMenuString")); @@ -2321,7 +2319,10 @@ void wxWindow::MSWDetachWindowMenu() if ( wxStrcmp(buf, wxT("&Window")) == 0 ) { - RemoveMenu(hMenu, i, MF_BYPOSITION); + if ( !::RemoveMenu(hMenu, i, MF_BYPOSITION) ) + { + wxLogLastError(wxT("RemoveMenu")); + } break; }