+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError(wxT("Error setting parent for submenu. Error: %s\n"), sError.c_str());
+ return NULLHANDLE;
+ }
+
+ if (!::WinSetOwner((*it)->m_vMenuData.hwndSubMenu, m_hMenu))
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError(wxT("Error setting parent for submenu. Error: %s\n"), sError.c_str());
+ return NULLHANDLE;
+ }
+
+ (*it)->m_vMenuData.iPosition = i;
+
+ rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&(*it)->m_vMenuData, (MPARAM)m_titles[i].c_str());
+ if (rc == (APIRET)MIT_MEMERROR || rc == (APIRET)MIT_ERROR)
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError(wxT("Error inserting or appending a menuitem. Error: %s\n"), sError.c_str());
+ return NULLHANDLE;