void CMFCAppDlg::OnBnClickedButton5() { // TODO: 在此添加控件通知处理程序代码 if (MessageBox(_T("确定退出本程序?"), _T("退出"), MB_OKCANCEL) == IDOK) { if (CanExit()) CDialog::OnCancel(); } }
LRESULT CMFCAppDlg::OnTrayNotify(WPARAM wParam, LPARAM lParam) { static int flage = 1; UINT uMsg = (UINT)lParam; switch (uMsg) { case WM_RBUTTONUP: { //右键处理 CMenu menuTray; CPoint point; int id; GetCursorPos(&point); menuTray.LoadMenu(IDR_MENU2); id = menuTray.GetSubMenu(0)->TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this); switch (id) { case ID_TRAY_EXIT: if (CanExit()) CDialog::OnCancel(); break; default: break; } break; } case WM_LBUTTONDBLCLK: if (flage) { ShowWindow(SW_HIDE); flage = 0; } else { SetForegroundWindow(); ShowWindow(SW_SHOWNORMAL); flage = 1; } break; default: break; } return 0; }
dword AutoStartPage::OnKey( dword key, dword extKey ) { switch ( key ) { case RKEY_Exit: if ( CanExit() ) Close(); return 0; case RKEY_Mute: // pass Mute to the firmware return key; case RKEY_Menu: { if (menuActivates) { Close(); return key; } Replace(new ConfigPage()); return 0; } case RKEY_PlayList: if ( CanExit() ) Replace(new LoadedTAPPage()); return 0; case RKEY_VolUp: { int index = GetSelectedIndex(); if ( index < (int)m_taps.size()-1 ) { // swap the filenames AutoStartTAP t = m_taps[index]; m_taps[index] = m_taps[index+1]; m_taps[index+1] = t; // move the selection MoveSelection( 1, false ); m_dirty = true; } return 0; } case RKEY_VolDown: { int index = GetSelectedIndex(); if ( index > 0 && index < (int)m_taps.size() ) { // swap the filenames AutoStartTAP t = m_taps[index]; m_taps[index] = m_taps[index-1]; m_taps[index-1] = t; // move the selection MoveSelection( -1, false ); m_dirty = true; } return 0; } case RKEY_NewF1: { // enable/disable TAP int index = GetSelectedIndex(); EnableTAP( index, !m_taps[index].enabled ); return 0; } case RKEY_F2: { int index = GetSelectedIndex(); if ( index < (int)m_taps.size() ) { bool enable = !m_taps[index].enabled; for ( unsigned int i = 0; i < m_taps.size(); ++i ) EnableTAP( i, enable ); } return 0; } // Discard changes case RKEY_Recall: // get rid of the list items, then the DiscardItems(); AddItem(new SimpleTextListItem(this, 0, "", "Loading...")); Draw(); PopulateList(); m_dirty = false; return 0; // Save Changes case RKEY_Record: Save(); Close(); return 0; } ListPage::OnKey( key, extKey ); return 0; }
void c_idk_winX_dlg::OnCancel() { if (CanExit()) CDialog::OnCancel(); }
void c_idk_winX_dlg::OnClose() { if (CanExit()) CDialog::OnClose(); }
void CKODEKDlg::OnCancel() { run(this, TERM); if (CanExit()) CDialogEx::OnCancel(); }