void CFrameWnd::OnInitMenuPopup( CMenu *pPopupMenu, UINT nIndex, BOOL bSysMenu ) /******************************************************************************/ { CWnd::OnInitMenuPopup( pPopupMenu, nIndex, bSysMenu ); AFX_CMDHANDLERINFO chi; UINT nCount; UINT nID; CCmdUI cui; cui.m_pMenu = pPopupMenu; if( !bSysMenu ) { ASSERT( pPopupMenu != NULL ); nCount = pPopupMenu->GetMenuItemCount(); for( int i = 0; i < nCount; i++ ) { nID = pPopupMenu->GetMenuItemID( i ); if( nID != -1 ) { cui.m_nIndex = i; cui.m_nID = nID; cui.m_pSubMenu = NULL; cui.m_bContinueRouting = FALSE; if( !OnCmdMsg( nID, CN_UPDATE_COMMAND_UI, &cui, NULL ) ) { if( m_bAutoMenuEnable && nID < 0xF000 && !OnCmdMsg( nID, CN_COMMAND, NULL, &chi ) ) { pPopupMenu->EnableMenuItem( nID, MF_BYCOMMAND | MF_GRAYED ); } } } } } }
void COleDocument::OnUpdateObjectVerbMenu(CCmdUI* pCmdUI) { if (pCmdUI->m_pMenu == NULL || pCmdUI->m_pParentMenu == NULL) { // not a menu or is on sub-menu (don't recurse) pCmdUI->ContinueRouting(); return; } // check for single selection COleClientItem* pItem = GetPrimarySelectedItem(GetRoutingView_()); if (pItem == NULL || pItem->GetType() == OT_STATIC) { // no selection, or is 'static' item pCmdUI->Enable(FALSE); } // only include Convert... if there is a handler for ID_OLE_EDIT_CONVERT UINT nConvertID = ID_OLE_EDIT_CONVERT; AFX_CMDHANDLERINFO info; if (!OnCmdMsg(ID_OLE_EDIT_CONVERT, CN_COMMAND, NULL, &info)) nConvertID = 0; // update the menu AfxOleSetEditMenu(GetPrimarySelectedItem(GetRoutingView_()), pCmdUI->m_pMenu, pCmdUI->m_nIndex, ID_OLE_VERB_FIRST, ID_OLE_VERB_LAST, nConvertID); }
void CEsmRefCellPage::OnContextMenu(CWnd* pWnd, CPoint Point) { CMenu Menu; CMenu* pPopup; BOOL Result; CCmdUI MenuState; int Index; /* Get the popup menu to display */ Result = Menu.LoadMenu(IDR_CELLREF_MENU); if (!Result) return; pPopup = Menu.GetSubMenu(0); if (pPopup == NULL) return; /* Force the update of the menu commands */ for (Index = 0; Index < (int) pPopup->GetMenuItemCount(); Index++) { MenuState.m_nID = pPopup->GetMenuItemID(Index); MenuState.m_nIndex = Index; MenuState.m_pMenu = pPopup; MenuState.m_pOther = NULL; MenuState.m_pSubMenu = NULL; MenuState.m_nIndexMax = pPopup->GetMenuItemCount(); if (MenuState.m_nID != 0) { OnCmdMsg(MenuState.m_nID, CN_UPDATE_COMMAND_UI, &MenuState, NULL); } } if (pWnd->GetDlgCtrlID() == IDC_OBJECTLIST) { pPopup->TrackPopupMenu(TPM_RIGHTBUTTON | TPM_LEFTALIGN, Point.x, Point.y, this); } }
BOOL CTRiASToolBar::OnCommand(WPARAM wParam, LPARAM lParam) { #if !defined(_USE_SEC_CLASSES) { // spezielle Behandlung des VK_RETURN in EditControl einer ComboBox HWND hFocusWnd = ::GetFocus(); if (IsClass (hFocusWnd, "Edit")) { // if it's an edit control: if (IDOK == wParam && 0 == lParam) { // VK_RETURN in EditTeil einer ComboBox UINT uiID = ::GetDlgCtrlID(hFocusWnd); HWND hWndCBox = ::GetParent(hFocusWnd); if (IsClass (hWndCBox, "ComboBox")) { uiID = ::GetDlgCtrlID (hWndCBox); // der ComboBox den Event schicken if (OnCmdMsg(uiID, CBN_HITRETURN, NULL, NULL)) return true; } } } } #endif // _USE_SEC_CLASSES return SECCustomToolBar::OnCommand(wParam, lParam); }
BOOL CFrameWnd::CanEnterHelpMode() { ASSERT(m_bHelpMode != HELP_ACTIVE); // already in help mode? // unable to start help if the cursor cannot be loaded from the resources if (afxData.hcurHelp == NULL) { // load help cursor after handles have been setup HINSTANCE hInst = AfxFindResourceHandle( MAKEINTRESOURCE(AFX_IDC_CONTEXTHELP), RT_GROUP_CURSOR); afxData.hcurHelp = LoadCursor(hInst, MAKEINTRESOURCE(AFX_IDC_CONTEXTHELP)); if (afxData.hcurHelp == NULL) return FALSE; } // return TRUE if there is a handler for ID_CONTEXT_HELP AFX_CMDHANDLERINFO info; return OnCmdMsg(ID_CONTEXT_HELP, CN_COMMAND, NULL, &info); }
BOOL CWinApp::ProcessShellCommand( CCommandLineInfo &rCmdInfo ) /*************************************************************/ { if( rCmdInfo.m_nShellCommand == CCommandLineInfo::FileNew ) { if( !OnCmdMsg( ID_FILE_NEW, 0, NULL, NULL ) ) { OnFileNew(); } if( m_pMainWnd == NULL ) { return( FALSE ); } } else if( rCmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen || rCmdInfo.m_nShellCommand == CCommandLineInfo::FilePrint || rCmdInfo.m_nShellCommand == CCommandLineInfo::FilePrintTo ) { AfxMessageBox(rCmdInfo.m_strFileName); CDocument *pDoc = OpenDocumentFile( rCmdInfo.m_strFileName ); if( pDoc == NULL ) { return( FALSE ); } } else if( rCmdInfo.m_nShellCommand == CCommandLineInfo::FileDDE ) { m_nCmdShow = SW_HIDE; } return( TRUE ); }
BOOL CWnd::OnCommand(WPARAM wParam, LPARAM lParam) { return OnCmdMsg(0, 0); }
BOOL CGalileoApp::InitInstance() { char iometer_path[MAX_PATH]; char *p; test_state = TestIdle; login_state = closed; // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #if _MSC_VER < 1300 #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif #endif //init file version strings GetAppFileVersionString(&m_pVersionString, &m_pVersionStringWithDebug); SetRegistryKey( "Intel" ); // Stores information in the registry under // HKEY_CURRENT_USER\Software\Intel. LoadStdProfileSettings(); // Load standard INI file options (including MRU) // // Check to see if the end user license agreement should be displayed. // If the current version is not stored in the registry, disply the EULA. // #ifndef _DEBUG if ( GetProfileString( "Settings", "Version" ) != m_pVersionString ) { CLegalBox legalDlg; // Display EULA. if ( legalDlg.DoModal() == IDOK ) // User agrees to terms, so store the version in the registry. WriteProfileString( "Settings", "Version", m_pVersionString ); else return FALSE; // User does not agree to terms so exit. } #endif // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CGalileoDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CGalileoView)); AddDocTemplate(pDocTemplate); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // // Pass the command line info to cmdline.ParseParam(). // Here is the expected syntax: // // iometer ? // iometer [config_file [result_file [timeout_value]]] // iometer [/c config_file] [/r results_file] [/t timeout_value] // // ? - show Iometer version number and command line syntax // // config_file - the name of the Iometer configuration file to restore // when Iometer starts (must be a valid .icf file) // // results_file - the name of a writable text file to which the test // results should be appended. If the file doesn't exist, it will be // created. // // timeout_value - the number of seconds to wait for managers to log in // when restoring a config file. // // If both config_file and results_file are specified, Iometer will // attempt to run the test in batch mode, requiring no user intervention // to load the config file, start the tests, stop the tests (if a run time // was specified in the Test Setup tab), and close Iometer. Batch mode // can be canceled by aborting the manager waiting list dialog or by // manually stopping a test while it is running. // CWinApp::ParseCommandLine(cmdline); // If the command line parser had any trouble, kill the program. if ( cmdline.m_bFail ) return FALSE; if ( !OnCmdMsg(ID_FILE_NEW, 0, NULL, NULL) ) { OnFileNew(); } if (m_pMainWnd == NULL) { ErrorMessage("Error creating application's main frame. " "Please report this as an Iometer bug."); return FALSE; } // Fill in the local address strings. IdentifyLocalAddresses(); // Set the status bar. CRect rect; m_wndStatusBar.GetWindowRect( &rect ); int* widths; widths = (int*)malloc( sizeof(int) * 3 ); widths[0] = rect.Width() - 300; widths[1] = rect.Width() - 150; widths[2] = -1; m_wndStatusBar.GetStatusBarCtrl().SetParts( 3, widths ); free( widths ); // Set status bar text. pView->ClearStatusBar(); // Disable most buttons. pView->ButtonReset(); // make sure CGalileoApp::OnIdle() gets called at least once in a while pView->SetTimer( IDLE_TIMER, IDLE_DELAY, NULL ); // Get the full pathname for Iometer.exe. if ( !GetModuleFileName( NULL, iometer_path, sizeof( iometer_path ) ) ) { ErrorMessage( "Could not get Iometer.exe pathname!" ); // Set iometer_path to a null string; this will make NEW_WORKER_COMMAND // search for Dynamo in the current directory and $PATH iometer_path[0] = '\0'; } // Find the last backslash in the pathname, if any if ( p = strrchr( iometer_path, '\\' ) ) { // Terminate the string right after the last backslash, leaving // the full pathname of the directory containing Iometer.exe. p++; *p = '\0'; } // Build the command line to launch Dynamo. We must quote the pathname in case it // contains any spaces, but the "start" command (NEW_WORKER_COMMAND) assumes the // first quoted argument is the window title, so we must provide it twice. new_manager_command_line_format = (CString) NEW_WORKER_COMMAND + "\"" + iometer_path + NEW_WORKER_EXECUTABLE + "%s\"" + " " + "\"" + iometer_path + NEW_WORKER_EXECUTABLE + "\"%s"; if ( cmdline.GetConfigFile().IsEmpty() ) { #ifndef _DEBUG // If the default config file exists, load it. if ( ::GetFileAttributes(DEFAULT_CONFIG_FILE) != 0xFFFFFFFF ) { OpenDocumentFile(DEFAULT_CONFIG_FILE); } else { // If no config file was specified on the command line // and the default config file doesn't exist, start a // local manager.with no command line options. LaunchDynamo(); } #endif } else { // If a config file was specified on the command line, open it OpenDocumentFile( cmdline.GetConfigFile() ); } return TRUE; }
BOOL CWnd::OnCommand(WPARAM wParam, LPARAM lParam) { cout << "CWnd::OnCommand()" << endl; // ... return OnCmdMsg(0, 0); }