Eliminating Menu Bar
MICHAEL@datatree.com Tuesday, June 25, 1996 Environment: VC++ 4.1 and Windows 95 My SDI application screen is designed to be nothing more than a simple window with 4-6 bitmap buttons. Therefore, no system menu, no tool bar, no minimize box, no maximize box, no close box and no menu bar. No problem eliminating everything but the MENU BAR. Any ideas? --------------------------- Michael L. Thal Data Tree Corporation voice: (619) 231-3300 fax: (619) 231-3301
Lin Sebastian Kayser -- 100532.2621@compuserve.com Saturday, June 29, 1996 [Mini-digest: 2 responses, culled from many] In your CMainframe::OnCreate() simply add SetMenu(NULL); This may not be the most elegant way but it works. Regards, Lin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Lin Sebastian Kayser - Lizard Software, Germany . . High Speed CNC System Software for ARADEX Automation . . http://ourworld.compuserve.com/homepages/Lin_Kayser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...writing at 12:21:06 29-Jun-1996 (GMT +1:00) -----From: David DoughtyHaving experienced the same problem, here is the solution which was provided to me. The following overload of LoadFrame takes care of eliminating the main menu. Notice that the 6th argument to Create is NULL. BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext) { // only do this once ASSERT_VALID_IDR(nIDResource); ASSERT(m_nIDHelp == 0 || m_nIDHelp == nIDResource); m_nIDHelp = nIDResource; // ID for help context (+HID_BASE_RESOURCE) CString strFullString; if (strFullString.LoadString(nIDResource)) AfxExtractSubString(m_strTitle, strFullString, 0); // first sub-string if (!AfxDeferRegisterClass(AFX_WNDFRAMEORVIEW_REG)) return FALSE; // attempt to create the window. NULL out the menu argument. LPCTSTR lpszClass = GetIconWndClass(dwDefaultStyle, nIDResource); LPCTSTR lpszTitle = m_strTitle; if (!Create(lpszClass, lpszTitle, dwDefaultStyle, rectDefault, pParentWnd, 0L, 0L, pContext)) { return FALSE; // will self destruct on failure normally } // save the default menu handle ASSERT(m_hWnd != NULL); m_hMenuDefault = ::GetMenu(m_hWnd); // load accelerator resource LoadAccelTable(MAKEINTRESOURCE(nIDResource)); if (pContext == NULL) // send initial update SendMessageToDescendants(WM_INITIALUPDATE, 0, 0, TRUE, TRUE); return TRUE; }
| Вернуться в корень Архива |