LRESULT CClientDlg::OnPatchTermSrv( WPARAM wp, LPARAM lp ) { BOOL bFlag=false; if (wcsstr((WCHAR*)wp,L"AutoAdminLogon")) { if (!wcsstr((WCHAR*)wp,L" is ")) { if (wcsstr((WCHAR*)wp,L"Enable")) bFlag=true; CMenu* pMenu = GetMenu(); if(pMenu) { UINT state = pMenu->GetMenuState(ID_TOOLS_AUTOLOGONON, MF_BYCOMMAND); if(state == 0xFFFFFFFF) return 0; pMenu->EnableMenuItem(ID_TOOLS_AUTOLOGONON,MF_BYCOMMAND ); if (! bFlag) { pMenu->CheckMenuItem(ID_TOOLS_AUTOLOGONON, MF_UNCHECKED | MF_BYCOMMAND); } else { pMenu->CheckMenuItem(ID_TOOLS_AUTOLOGONON, MF_CHECKED | MF_BYCOMMAND); } } } } Log( (WCHAR*)wp ); return 0; }
void COpenCVInterfaceDlg::OnToolsGraylevelcolumn() { if(mainImage.empty()) MessageBox("No image loaded"); else { CMenu* menu = GetMenu(); CMenu* submenu = menu->GetSubMenu(1); UINT state = submenu->GetMenuState(ID_TOOLS_GRAYLEVELCOLUMN,MF_BYCOMMAND); ASSERT(state != 0xFFFFFFFF); if(state & MF_CHECKED) submenu->CheckMenuItem(ID_TOOLS_GRAYLEVELCOLUMN,MF_UNCHECKED | MF_BYCOMMAND); else { submenu->CheckMenuItem(ID_TOOLS_GRAYLEVELCOLUMN,MF_CHECKED | MF_BYCOMMAND); //creez pointer-ul Invalidate(); gr= GrayRowPtr(new GrayRow(mainImage,this)); //creez caseta gr->Create(GrayRow::IDD,0); //afisez caseta gr->ShowWindow(SW_SHOW); } } }
void CClientDlg::OnBnClickedCheck2() { CMenu* pMenu = GetMenu(); if(pMenu) { UINT state = pMenu->GetMenuState(ID_OPTIONS_AUTOUPDATE, MF_BYCOMMAND); if(state == 0xFFFFFFFF) return; if (state & MF_CHECKED) { pMenu->CheckMenuItem(ID_OPTIONS_AUTOUPDATE, MF_UNCHECKED | MF_BYCOMMAND); int i=200; SetEvent(hEvent); Sleep(1000); ResetEvent(hEvent); CloseHandle(hEvent); } else { pMenu->CheckMenuItem(ID_OPTIONS_AUTOUPDATE, MF_CHECKED | MF_BYCOMMAND); hEvent=CreateEvent(NULL,TRUE,FALSE,L"FirstStep"); AutoUpdThread=CreateThread(0,0,UpdateThread,this,0,&LPForThred); } } }
void player_start_editor::OnInitMenu(CMenu* pMenu) { int i; CMenu *m; // disable any items we should disable m = pMenu->GetSubMenu(0); // uncheck all menu items for (i = 0; i < Num_teams; i++ ){ m->CheckMenuItem(i, MF_BYPOSITION | MF_UNCHECKED); } for ( i = Num_teams; i < MAX_TVT_TEAMS; i++ ){ m->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED); } // put a check next to the currently selected item m->CheckMenuItem(selected_team, MF_BYPOSITION | MF_CHECKED); m = pMenu->GetSubMenu(1); if (Num_teams > 1) { m->CheckMenuItem(ID_AUTOBALANCE, autobalance ? MF_CHECKED : MF_UNCHECKED); } else { m->EnableMenuItem(ID_AUTOBALANCE, MF_GRAYED); } CDialog::OnInitMenu(pMenu); }
void CVideoDlg::SaveAvi(void) { CMenu *pSysMenu = GetSystemMenu(FALSE); if (pSysMenu->GetMenuState(IDM_SAVEAVI, MF_BYCOMMAND) & MF_CHECKED) { pSysMenu->CheckMenuItem(IDM_SAVEAVI, MF_UNCHECKED); m_aviFile = ""; m_aviStream.Close(); return; } CString strFileName = m_IPAddress + CTime::GetCurrentTime().Format("_%Y-%m-%d_%H-%M-%S.avi"); CFileDialog dlg(FALSE, "avi", strFileName, OFN_OVERWRITEPROMPT, "视频文件(*.avi)|*.avi|", this); if(dlg.DoModal () != IDOK) return; m_aviFile = dlg.GetPathName(); if (!m_aviStream.Open(m_aviFile, m_lpbmi)) { m_aviFile = ""; MessageBox("创建录像文件失败"); } else { pSysMenu->CheckMenuItem(IDM_SAVEAVI, MF_CHECKED); } }
void CKeyBoardDlg::OnSysCommand(UINT nID, LPARAM lParam) { if (nID == IDM_ENABLE_OFFLINE) { CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { BYTE bToken = COMMAND_KEYBOARD_OFFLINE; m_iocpServer->Send(m_pContext, &bToken, 1); m_bIsOfflineRecord = !m_bIsOfflineRecord; if (m_bIsOfflineRecord) pSysMenu->CheckMenuItem(IDM_ENABLE_OFFLINE, MF_UNCHECKED); else pSysMenu->CheckMenuItem(IDM_ENABLE_OFFLINE, MF_CHECKED); } UpdateTitle(); } else if (nID == IDM_CLEAR_RECORD) { BYTE bToken = COMMAND_KEYBOARD_CLEAR; m_iocpServer->Send(m_pContext, &bToken, 1); m_edit.SetWindowText(""); } else { CDialog::OnSysCommand(nID, lParam); } }
void CPlayerDialog::OnBnClickedButtonPtz() { // TODO: 在此添加控件通知处理程序代码 CMenu *pSubM = this->m_menuPtz.GetSubMenu( 0 ); if ( pSubM && pSubM->m_hMenu ) { CRect rcBtnPtz; this->m_btnPtz.GetWindowRect( rcBtnPtz ); CPoint ptCenterPtn = rcBtnPtz.CenterPoint(); BOOL bDigitalPtz = m_cVideoWnd.IsDigitalPtz(); pSubM->CheckMenuItem( ID_MENU_PTZ, MF_BYCOMMAND | ( bDigitalPtz ? MF_UNCHECKED : MF_CHECKED ) ); pSubM->CheckMenuItem( ID_MENU_DIGITAL_PTZ, MF_BYCOMMAND | ( bDigitalPtz ? MF_CHECKED : MF_UNCHECKED ) ); pSubM->TrackPopupMenu( TPM_CENTERALIGN, ptCenterPtn.x, ptCenterPtn.y, this ); } else { Log() << _T( "Ptz Menu is NULL!!" ) << endl; } }
void CMainFrame::OnColorRange(UINT nID) { CMenu *pMenu = GetMenu(); pMenu->CheckMenuItem(m_nCurrentColor + ID_COLOR_RED, MF_UNCHECKED); m_nCurrentColor = nID - ID_COLOR_RED; //新的 pMenu->CheckMenuItem(nID, MF_CHECKED); CString str; str.Format(_T("color=%d"),m_nCurrentColor); MessageBox(str); }
void set_value(int id) // sets selected menu item { for(int i=0; i<nItems; i++) popmenu.CheckMenuItem(i+100,MF_UNCHECKED); popmenu.CheckMenuItem(id+100,MF_CHECKED); CString txt; popmenu.GetMenuString(id+100, txt, 24 ); back.redraw(); butt.redraw(); txtbox.SetWindowText(txt); curr_sel=id+100; };
void CLogViewDlg::DoPanelCmdHelper(CDialog* pPanel, WORD wCmdId, WORD wCmdId2 /* = 0 */) { BOOL bPanelVisible = pPanel->IsWindowVisible(); pPanel->ShowWindow(bPanelVisible ? SW_HIDE : SW_SHOWNOACTIVATE); CMenu* pPanelMenu = GetMenu()->GetSubMenu(2); pPanelMenu->CheckMenuItem(wCmdId, MF_BYCOMMAND | (bPanelVisible ? MF_UNCHECKED : MF_CHECKED)); if(wCmdId2 != 0) pPanelMenu->CheckMenuItem(wCmdId2, MF_BYCOMMAND | (bPanelVisible ? MF_UNCHECKED : MF_CHECKED)); }
/** * Toggles between including the file into the material list and not. */ void MEMainFrame::OnViewIncludeFile() { CMenu *mmenu = GetMenu(); UINT state = mmenu->GetMenuState( ID_VIEW_INCLUDEFILENAME, MF_BYCOMMAND ); ASSERT( state != 0xFFFFFFFF ); if( state & MF_CHECKED ) { mmenu->CheckMenuItem( ID_VIEW_INCLUDEFILENAME, MF_UNCHECKED | MF_BYCOMMAND ); m_materialTreeView->InitializeMaterialList( false ); } else { mmenu->CheckMenuItem( ID_VIEW_INCLUDEFILENAME, MF_CHECKED | MF_BYCOMMAND ); m_materialTreeView->InitializeMaterialList( true ); } }
void CBiFoldView::OnSetFocus(CWnd* pOldWnd) { CFormView::OnSetFocus(pOldWnd); //In case the user has two bifoldview windows open, the menu displayed must show the correct checkmark //state -- this code guarantees that CMenu* menu = GetBiFoldDocument()->menuframe->GetMenu( ); if (forbidunimolecular) menu->CheckMenuItem(ID_FORCE_FORBIDUNIMOLECULARPAIRS,MF_CHECKED); else menu->CheckMenuItem(ID_FORCE_FORBIDUNIMOLECULARPAIRS,MF_UNCHECKED); }
void CBiFoldView::OnForceForbidunimolecularpairs() { //User has chosen the forbid unimolecular pair menu option CMenu* menu = GetBiFoldDocument()->menuframe->GetMenu( ); forbidunimolecular = !forbidunimolecular; if (forbidunimolecular) menu->CheckMenuItem(ID_FORCE_FORBIDUNIMOLECULARPAIRS,MF_CHECKED); else menu->CheckMenuItem(ID_FORCE_FORBIDUNIMOLECULARPAIRS,MF_UNCHECKED); }
void CFoldView::OnSubfold() { //User has chosen the SubFold menu option CMenu* menu = GetFoldDocument()->menuframe->GetMenu( ); subfold = !subfold; if (subfold) menu->CheckMenuItem(ID_SUBFOLD,MF_CHECKED); else menu->CheckMenuItem(ID_SUBFOLD,MF_UNCHECKED); }
void CRevisionGraphDlg::OnViewFilter() { /* CSyncPointer<CAllRevisionGraphOptions> options (m_Graph.m_state.GetOptions()); CRevisionInRange* revisionRange = options->GetOption<CRevisionInRange>(); svn_revnum_t head = m_Graph.m_state.GetHeadRevision(); svn_revnum_t lowerLimit = revisionRange->GetLowerLimit(); svn_revnum_t upperLimit = revisionRange->GetUpperLimit(); CRemovePathsBySubString* pathFilter = options->GetOption<CRemovePathsBySubString>(); */ CRevGraphFilterDlg dlg; dlg.m_bCurrentBranch = this->m_Graph.m_bCurrentBranch; dlg.SetRevisionRange(m_Graph.m_FromRev, m_Graph.m_ToRev); if (dlg.DoModal()==IDOK) { // user pressed OK to dismiss the dialog, which means // we have to accept the new filter settings and apply them dlg.GetRevisionRange(m_Graph.m_FromRev, m_Graph.m_ToRev); // update menu & toolbar this->m_Graph.m_bCurrentBranch = dlg.m_bCurrentBranch; CMenu * pMenu = GetMenu(); int tbstate = m_ToolBar.GetToolBarCtrl().GetState(ID_VIEW_FILTER); if (m_Graph.m_bCurrentBranch || !m_Graph.m_FromRev.IsEmpty() || !m_Graph.m_ToRev.IsEmpty()) { if (pMenu != NULL) pMenu->CheckMenuItem(ID_VIEW_FILTER, MF_BYCOMMAND | MF_CHECKED); m_ToolBar.GetToolBarCtrl().SetState(ID_VIEW_FILTER, tbstate | TBSTATE_CHECKED); } else { if (pMenu != NULL) pMenu->CheckMenuItem(ID_VIEW_FILTER, MF_BYCOMMAND | MF_UNCHECKED); m_ToolBar.GetToolBarCtrl().SetState(ID_VIEW_FILTER, tbstate & (~TBSTATE_CHECKED)); } // re-run query StartWorkerThread(); } }
void CSketcherView::OnContextMenu(CWnd* pWnd, CPoint point) { CMenu menu; menu.LoadMenu(IDR_CURSOR_MENU); // Set check marks if it's the no element menu if(m_pSelected == 0) { // Check color menu items COLORREF Color = GetDocument()->GetElementColor(); menu.CheckMenuItem(ID_COLOR_BLACK, (BLACK==Color?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); menu.CheckMenuItem(ID_COLOR_RED, (RED==Color?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); menu.CheckMenuItem(ID_COLOR_GREEN, (GREEN==Color?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); menu.CheckMenuItem(ID_COLOR_BLUE, (BLUE==Color?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); // Check element menu items unsigned int ElementType = GetDocument()->GetElementType(); menu.CheckMenuItem(ID_ELEMENT_LINE, (LINE==ElementType?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); menu.CheckMenuItem(ID_ELEMENT_RECTANGLE, (RECTANGLE==ElementType?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); menu.CheckMenuItem(ID_ELEMENT_CIRCLE, (CIRCLE==ElementType?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); menu.CheckMenuItem(ID_ELEMENT_CURVE, (CURVE==ElementType?MF_CHECKED:MF_UNCHECKED)|MF_BYCOMMAND); } CMenu* pPopup = menu.GetSubMenu(m_pSelected == 0 ? 1 : 0); ASSERT(pPopup != NULL); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); }
void CSequenceEditor::OnReadReadwhiletyping() { readwhiletyping=(!readwhiletyping); CMenu* menu = GetSeqDocument()->pFrame->GetMenu( ); if (readwhiletyping) menu->CheckMenuItem(ID_READ_READWHILETYPING,MF_CHECKED); else menu->CheckMenuItem(ID_READ_READWHILETYPING,MF_UNCHECKED); }
void CScriptEdit::RefreshMenu() { CMenu *pMenu; pMenu=GetMenu(); if(pMenu) { pMenu->CheckMenuItem(ID_OPTIONS_AUTOCHECK, MF_SET(!(editflg&NOCHECK))); pMenu->CheckMenuItem(ID_OPTIONS_LARGEINDENT, MF_SET(!(editflg&INDENT))); pMenu->CheckMenuItem(ID_OPTIONS_USEINTERNALDECOMPILER, MF_SET(!(editflg&INTERNALDECOMP))); pMenu->CheckMenuItem(ID_OPTIONS_USEINTERNALCOMPILER, MF_SET(!(editflg&INTERNALCOMPILER))); pMenu->CheckMenuItem(ID_OPTIONS_LOGGING, MF_SET(weiduflg&WEI_LOGGING)); } }
void CPackageToolDoc::OnSetupservermode() { // TODO: 在此添加命令处理程序代码 m_lCurPatchMode = 0; CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd(); if(pMainFrame) { CMenu* pMenu = pMainFrame->GetMenu(); if(pMenu) { pMenu->CheckMenuItem(ID_SETUPSERVERMODE, MF_CHECKED); pMenu->CheckMenuItem(ID_SETUPCLIENTMODE, MF_UNCHECKED); } } }
// Create the Control // this, ID, name, txt font, left, top, width void create(CKXPluginGUI* parent,UINT ID, char* name,CFont* sfont,int num_items, int left, int top, int wd) { // add the kX static bitmap holder back.create("",left,top,backbmp,parent,kMETHOD_TRANS); back.show(); // add the kX button parent->create_checkbox(butt, ID, name, left+wd, top, 20); butt.set_method(kMETHOD_TRANS); butt.set_check(0); butt.show(); // add the text label txtbox.Create("",WS_CHILD|WS_VISIBLE|SS_LEFT, CRect(CPoint(left+5,top+4),CSize(wd-5,12)), parent, NULL); txtbox.SetFont(sfont,NULL); //txtbox.SetTextColor(RGB(241,159,3)); txtbox.SetBkColor(CLR_NONE); // create the popmenu nItems = num_items; popmenu.CreatePopupMenu(); for(int i=0; i<nItems; i++) // add items { char tmp[64]; sprintf(tmp,"%d -- Item --", i); popmenu.AppendMenu(MF_STRING, i+100, tmp); } popmenu.CheckMenuItem(100,MF_CHECKED); // check first item curr_sel=0; };
void COutputsPage::OnPMixSelect( UINT nID ) ///////////////////////////////////////////////////////////////////////////// { CMenu Menu; CMenu PopupMenu; CPoint Point; int nDst, nSrc; ULONG ulValue; m_nPlaySelectID = nID; // remember which control launced the popup menu nDst = (m_nPlaySelectID - IDC_OUT1_PMIXA_SELECT) / (IDC_OUT2_PMIXA_SELECT - IDC_OUT1_PMIXA_SELECT); nSrc = ((m_nPlaySelectID - IDC_OUT1_PMIXA_SELECT) - (nDst * (IDC_OUT2_PMIXA_SELECT - IDC_OUT1_PMIXA_SELECT))) / ((IDC_OUT1_PMIXD_SELECT - IDC_OUT1_PMIXA_SELECT) / 2); m_pHalMixer->GetControl( LINE_OUT_1 + nDst, LINE_PLAY_MIXA + nSrc, CONTROL_SOURCE, 0, &ulValue ); Menu.LoadMenu( IDR_OUTPUT_SOURCE ); PopupMenu.Attach( Menu.GetSubMenu( 0 )->m_hMenu ); GetCursorPos( &Point ); PopupMenu.CheckMenuItem( IDM_SOURCE_RECORD1LEFT + ulValue, MF_BYCOMMAND | MF_CHECKED ); PopupMenu.TrackPopupMenu( TPM_LEFTALIGN, Point.x, Point.y, this, NULL ); }
BOOL CKeyBoardDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { //pSysMenu->DeleteMenu(SC_TASKLIST, MF_BYCOMMAND); pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ENABLE_OFFLINE, "离线记录(&O)"); pSysMenu->AppendMenu(MF_STRING, IDM_CLEAR_RECORD, "清空记录(&C)"); if (m_bIsOfflineRecord) pSysMenu->CheckMenuItem(IDM_ENABLE_OFFLINE, MF_CHECKED); } SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon m_edit.SetLimitText(MAXDWORD); // 设置最大长度 ResizeEdit(); UpdateTitle(); SendNext(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CVideoDlg::OnSysCommand(UINT nID, LPARAM lParam) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CMenu* pSysMenu = GetSystemMenu(FALSE); switch (nID) { case IDM_ENABLECOMPRESS: { bool bIsChecked = pSysMenu->GetMenuState(IDM_ENABLECOMPRESS, MF_BYCOMMAND) & MF_CHECKED; pSysMenu->CheckMenuItem(IDM_ENABLECOMPRESS, bIsChecked ? MF_UNCHECKED : MF_CHECKED); bIsChecked = !bIsChecked; BYTE bToken = COMMAND_WEBCAM_ENABLECOMPRESS; if (!bIsChecked) bToken = COMMAND_WEBCAM_DISABLECOMPRESS; m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE)); break; } case IDM_SAVEAVI: { SaveAvi(); break; } } CDialog::OnSysCommand(nID, lParam); }
void CLogViewDlg::DoEnableRegexCmd() { CMenu* pPanelMenu = GetMenu()->GetSubMenu(3); BOOL bEnableRegex = !(pPanelMenu->GetMenuState(ID_OPTION_ENABLE_REGEX, MF_BYCOMMAND) & MF_CHECKED); pPanelMenu->CheckMenuItem(ID_OPTION_ENABLE_REGEX, MF_BYCOMMAND | (bEnableRegex ? MF_CHECKED : MF_UNCHECKED)); SetDlgItemText(IDC_LABEL_TEXT_FILTER, bEnableRegex ? _T("Rege&x Filter:") : _T("Te&xt Filter:")); if(bEnableRegex && CConfig::GetConfig().IsWildcardEnabled()) { CConfig::GetConfig().SetWildcardEnabled(!bEnableRegex); pPanelMenu->CheckMenuItem(ID_OPTION_ENABLE_WILDCARD, MF_BYCOMMAND | (!bEnableRegex ? MF_CHECKED : MF_UNCHECKED)); } CConfig::GetConfig().SetRegexEnabled(bEnableRegex); }
void CTextureFontGeneratorDlg::OnOptionsExportstroketemplates() { CMenu *pMenu = GetMenu(); int Checked = pMenu->GetMenuState(ID_OPTIONS_EXPORTSTROKETEMPLATES, 0) & MF_CHECKED; Checked ^= MF_CHECKED; pMenu->CheckMenuItem( ID_OPTIONS_EXPORTSTROKETEMPLATES, Checked ); }
int CDrawQuoteTabCtrl::OpenSecondBlockMenu(CString strMarketName, CPoint point) { CStringArray ayBlock; if (m_iBlockManager->GetBlockName(strMarketName, ayBlock) > 0) { CDrawQuoteTab* pTab = m_ayItem[m_nCurItem]; CString strCurItemName = pTab->m_strName; CMenu menu; menu.CreatePopupMenu(); int nCount(0); for (int i = 0; i < ayBlock.GetCount(); i++) { menu.AppendMenu(0, CDRAWTAB_ID_MENU_BLOCK_BEGIN + nCount, ayBlock.GetAt(i)); m_mapTempMenuIndex.SetAt(CDRAWTAB_ID_MENU_BLOCK_BEGIN+nCount, ayBlock.GetAt(i)); if (!strCurItemName.IsEmpty() && strCurItemName == ayBlock.GetAt(i)) { menu.CheckMenuItem(CDRAWTAB_ID_MENU_BLOCK_BEGIN+nCount,MF_BYCOMMAND|MF_CHECKED); } nCount++; } ////////////////////////////////////////////////////////////////////////// CWnd* pWnd = m_pDrawTabNotify->TabGetCWnd(); int nMenuID = menu.TrackPopupMenu(TPM_VERPOSANIMATION | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y,pWnd); menu.DestroyMenu(); return nMenuID; } return -1; }
int CDrawQuoteTabCtrl::OpenAllMarketMenu(CPoint point ) { CDrawQuoteTab* pTab = m_ayItem[m_nCurItem]; CString strCurItemName = pTab->m_strName; CArray<StockType> ayAllMarket; m_pDataSource->HSDataSourceEx_GetSystemMarketInfo(0, 0, ayAllMarket); short nPreMarket = 0; CMenu menu; menu.CreatePopupMenu(); for (int i=0; i<ayAllMarket.GetCount(); i++) { if ((nPreMarket&0xFF00) != (ayAllMarket.GetAt(i).m_nStockType&0xFF00)) { menu.AppendMenu(MF_SEPARATOR|MF_MENUBARBREAK); } menu.AppendMenu(MF_BYCOMMAND,CDRAWTAB_ID_MENU_MARKET_BEGIN+i,ayAllMarket.GetAt(i).m_stTypeName.m_szName); if (!strCurItemName.IsEmpty() && strCurItemName==ayAllMarket.GetAt(i).m_stTypeName.m_szName) { menu.CheckMenuItem(CDRAWTAB_ID_MENU_MARKET_BEGIN+i,MF_BYCOMMAND|MF_CHECKED); } CString strTemp; strTemp.Format("%s-%d",ayAllMarket.GetAt(i).m_stTypeName.m_szName,ayAllMarket.GetAt(i).m_nStockType); m_mapTempMenuIndex.SetAt(CDRAWTAB_ID_MENU_MARKET_BEGIN+i,strTemp); nPreMarket = (ayAllMarket.GetAt(i).m_nStockType&0xFF00); } CWnd* pWnd = m_pDrawTabNotify->TabGetCWnd(); int nMenuID = menu.TrackPopupMenu(TPM_VERPOSANIMATION | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,point.x,point.y,pWnd); menu.DestroyMenu(); return nMenuID; }
//右键弹出处理 void CComputerListView::OnContextMenu(CWnd*, CPoint point) { m_SelectRows.RemoveAll(); CMenu menu; CBCGPGridRow* pRow = GetGridCtrl()->GetCurSel(); if (pRow != NULL)//存在选中的子行 { CList<CBCGPGridItem*, CBCGPGridItem*> lstSelected; GetGridCtrl()->GetSelectedItems(lstSelected);//多重选择队列 POSITION pos = lstSelected.GetHeadPosition();//第一个 while (pos != NULL) { CBCGPGridItem* pItem = lstSelected.GetNext(pos);//下一个 m_SelectRows.Add((UINT)pItem->GetParentRow()->GetData());//保存选中的序号 } SendMessage(WM_LBUTTONUP);//弹起 VERIFY(menu.LoadMenu(IDR_COMPUTER_MENU));//载入 CMenu* pPopup = menu.GetSubMenu(0);//第一个子菜单 ASSERT(pPopup != NULL); #ifndef __USING_INTER_RESOURCE HMENU hTmp = pPopup->GetSubMenu(6)->GetSafeHmenu(); pPopup->ModifyMenu((UINT_PTR)hTmp,MF_POPUP,(UINT_PTR)hTmp,LOAD_STRING(IDS_REMOTE_OPERATION)); #endif //弹出菜单 theApp.GetContextMenuManager()->ShowPopupMenu(pPopup->Detach(), point.x, point.y, this, TRUE); } else { //扫描鼠标位置,点击在列栏上,才弹出此菜单 CRect rect; m_pWndGridCtrl->GetClientRect(rect); rect.bottom = 21; //栏高度大概为21个像素 ClientToScreen(rect); if (rect.PtInRect(point))//点击在栏上 { VERIFY(menu.LoadMenu(IDR_MENU_COLUMN));//载入列菜单 CMenu* pPopup = menu.GetSubMenu(0); ASSERT(pPopup != NULL); for (INT i = 0; i < GetGridCtrl()->GetColumnCount(); i++)//列枚举 {//动态插入与列项有关的菜单 pPopup->InsertMenu(i, MF_BYPOSITION, IDM_MINCOLUMNCMD + i, GetGridCtrl()->GetColumnName(i)); pPopup->CheckMenuItem(i, MF_BYPOSITION | (GetGridCtrl()->GetColumnVisible(i) ? MF_CHECKED : MF_UNCHECKED)); } theApp.GetContextMenuManager()->ShowPopupMenu(pPopup->Detach(), point.x, point.y, this, TRUE); } } }
void CKadLookupGraph::OnContextMenu(CWnd* /*pWnd*/, CPoint point) { CMenu menu; menu.CreatePopupMenu(); menu.AppendMenu(MF_STRING, MP_AUTOKADLOOKUPGRAPH, GetResString(IDS_AUTOKADLOOKUPGRAPH)); menu.CheckMenuItem(MP_AUTOKADLOOKUPGRAPH , thePrefs.GetAutoShowLookups() ? MF_CHECKED : MF_UNCHECKED); menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); }
void CLogViewDlg::DoOptionAutoScrollCmd() { CMenu* pPanelMenu = GetMenu()->GetSubMenu(3); BOOL bAutoScroll = !(pPanelMenu->GetMenuState(ID_OPTION_AUTOSCROLL, MF_BYCOMMAND) & MF_CHECKED); pPanelMenu->CheckMenuItem(ID_OPTION_AUTOSCROLL, MF_BYCOMMAND | (bAutoScroll ? MF_CHECKED : MF_UNCHECKED)); CConfig::GetConfig().SetAutoScroll(bAutoScroll); }