void wxMenuBar::Attach(wxFrame *frame) { wxMenuBarBase::Attach(frame); #if defined(WINCE_WITH_COMMANDBAR) if (!m_hMenu) this->Create(); if (!m_commandBar) m_commandBar = (WXHWND) CommandBar_Create(wxGetInstance(), (HWND) frame->GetHWND(), NewControlId()); if (m_commandBar) { if (m_hMenu) { if (!CommandBar_InsertMenubarEx((HWND) m_commandBar, NULL, (LPTSTR) m_hMenu, 0)) { wxLogLastError(wxT("CommandBar_InsertMenubarEx")); } } } #endif #if wxUSE_ACCEL RebuildAccelTable(); #endif // wxUSE_ACCEL }
LRESULT CLogView::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { #if defined( OS_WINCE ) #if !defined (OS_PLATFORM_MOTCE) SHINITDLGINFO shidi; shidi.dwMask = SHIDIM_FLAGS; shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;//SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN |SHIDIF_EMPTYMENU; shidi.hDlg = m_hWnd; SHInitDialog(&shidi); SHMENUBARINFO mbi = { sizeof(mbi), 0 }; mbi.hwndParent = m_hWnd; mbi.nToolBarId = IDR_LOGMENUBAR; // ID of toolbar resource mbi.hInstRes = _AtlBaseModule.GetResourceInstance(); mbi.dwFlags = SHCMBF_HMENU; SHCreateMenuBar(&mbi); // SendDlgItemMessage(IDC_LOGEDIT,WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT),0); #else SetWindowLong(GWL_STYLE,(long)WS_BORDER); ShowWindow(SW_MAXIMIZE); m_hWndCommandBar = CommandBar_Create(_AtlBaseModule.GetResourceInstance(), m_hWnd, 1); CommandBar_AddAdornments(m_hWndCommandBar, 0, 0 ); HMENU menu = LoadMenu(0, MAKEINTRESOURCE(IDR_LOGMENUBAR)); CommandBar_InsertMenubarEx(m_hWndCommandBar, 0, (LPTSTR)menu, 0); CommandBar_DrawMenuBar(m_hWndCommandBar, 0); CommandBar_Show(m_hWndCommandBar, TRUE); #endif loadLogText(); #elif defined(OS_WINDOWS) m_grip.InitGrip(m_hWnd); m_grip.ShowSizeGrip(); CWindow edit = GetDlgItem(IDC_LOGEDIT); ::SendMessage(edit.m_hWnd,EM_EXLIMITTEXT,0,2147483647); ::SendMessage(edit.m_hWnd, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS); SetTimer(100,1000,NULL); RECT rc = { 0,0,500,400 }; rc.left = getIniInt(_T("log_view_left"),0); rc.top = getIniInt(_T("log_view_top"),0); int width = getIniInt(_T("log_view_width"),500); rc.right = rc.left+width; int height = getIniInt(_T("log_view_height"),400); rc.bottom = rc.top+height; MoveWindow(&rc); #endif //OS_ bHandled = TRUE; return 1; // Let the system set the focus }
/* Set a "Menu Bar" on the given frame. * PocketPC places menubars at the bottom, which are non-dynamic * so we have a place holder menu item, which takes one to the menu-bar */ WCECOMPAT_API HWND __cdecl wceSetMenuBar(HWND frame, HWND cmdBarWnd, HMENU menu) { #ifdef POCKETPC_MENUS static HMENU javaMenu = NULL; HMENU hMenuBar, subMenu; SHMENUBARINFO mb; /* What we have to do here is pretty bad */ if (!theInstance) { return NULL; } if (!frame) { return NULL; } if (1) { /* Only way of creating a menubar is by loading it from a resouce */ /* This load is a sanity check */ javaMenu = LoadMenu(theInstance, MAKEINTRESOURCE(IDR_MENUBAR1)); if (!javaMenu) { return NULL; } memset(&mb, 0, sizeof(SHMENUBARINFO)); mb.cbSize = sizeof(SHMENUBARINFO); mb.hwndParent = frame; mb.dwFlags = 0; mb.nToolBarId = IDR_MENUBAR1; mb.nBmpId = 0; mb.hInstRes = theInstance; mb.cBmpImages = 0; /* If this fails, we're toast */ if (!SHCreateMenuBar(&mb)) { return NULL; } cmdBarWnd = mb.hwndMB; if (!cmdBarWnd) { return NULL; } } theCmdBarWnd = cmdBarWnd; javaMenu = SHGetMenu(cmdBarWnd); subMenu = GetSubMenu(javaMenu, 0); if (!subMenu) { return NULL; } /* Now, we simply cannot set the commandbar menu */ /* but we can set its submenu, by sending it the */ /* SHCMBM_SETSUBMENU message */ SHSetSubMenu(cmdBarWnd, JAVA_MENU_ID, menu); /* this is a marco, defined above */ #else /* ! POCKETPC_MENUS */ #define ID_CMDBAR 199 cmdBarWnd = CommandBar_Create(GetModuleHandle(NULL), frame, ID_CMDBAR); if (!CommandBar_InsertMenubarEx(cmdBarWnd, NULL,// No instance implies handle (LPTSTR) menu, 0)) { // Failure return (NULL); } #endif POCKETPC_MENUS #ifdef OBSOLOLETE theFrameWnd = frame; #endif return cmdBarWnd; }