+ for (size_t i = 0; i < nCount; i++)
+ {
+ APIRET rc;
+ ERRORID vError;
+ wxString sError;
+ HWND hSubMenu;
+
+ //
+ // Set the parent and owner of the submenues to be the menubar, not the desktop
+ //
+ hSubMenu = m_menus[i]->m_vMenuData.hwndSubMenu;
+ if (!::WinSetParent(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu, FALSE))
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError("Error setting parent for submenu. Error: %s\n", sError);
+ return NULLHANDLE;
+ }
+
+ if (!::WinSetOwner(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu))
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError("Error setting parent for submenu. Error: %s\n", sError);
+ return NULLHANDLE;
+ }
+
+ m_menus[i]->m_vMenuData.iPosition = i;
+
+ rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str());
+ if (rc == MIT_MEMERROR || rc == MIT_ERROR)
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError("Error inserting or appending a menuitem. Error: %s\n", sError);
+ return NULLHANDLE;
+ }
+ }
+ }
+ return m_hMenu;
+} // end of wxMenuBar::Create
+
+// ---------------------------------------------------------------------------
+// wxMenuBar functions to work with the top level submenus
+// ---------------------------------------------------------------------------
+
+//
+// NB: we don't support owner drawn top level items for now, if we do these
+// functions would have to be changed to use wxMenuItem as well
+//
+void wxMenuBar::EnableTop(
+ size_t nPos
+, bool bEnable
+)