示例#1
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// Process the messages from the Menu and Tool Bar

	UNREFERENCED_PARAMETER(lParam);

	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			OnFileNew();		return TRUE;
	case IDM_FILE_OPEN:			OnFileOpen();		return TRUE;
	case IDM_FILE_SAVE:			OnFileSave();		return TRUE;
	case IDM_FILE_SAVEAS:		OnFileSaveAs();		return TRUE;
	case IDM_FILE_PRINT:		OnFilePrint();		return TRUE;
	case IDM_PEN_COLOR:			OnPenColor();		return TRUE;
	case IDM_FILE_EXIT:			OnFileExit();		return TRUE;

	case IDW_FILE_MRU_FILE1:
	case IDW_FILE_MRU_FILE2:
	case IDW_FILE_MRU_FILE3:
	case IDW_FILE_MRU_FILE4:
	case IDW_FILE_MRU_FILE5:	OnFileMRU(wParam);	return TRUE;

	case IDW_VIEW_STATUSBAR:	return OnViewStatusBar();
	case IDW_VIEW_TOOLBAR:		return OnViewToolBar();
	case IDM_HELP_ABOUT:		return OnHelp();
	}

	return FALSE;
}
示例#2
0
LRESULT CNotePad::OnCommand(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	BOOL bRet = false;
	int wmId, wmEvent;
	wmId    = LOWORD(wParam);
	wmEvent = HIWORD(wParam);
	switch (wmEvent)
	{
	case EN_CHANGE:
		 bRet = 1;
		break;
	case EN_HSCROLL:
		 bRet = 1;
		break;
	}
	// 分析菜单选择:
	switch (wmId)
	{
		case IDM_ABOUT:
			DialogBox(m_hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
			break;
		case IDM_EXIT:
			DestroyWindow(hWnd);
			break;
		case ID_NEW:
			bRet = OnFileNew(hWnd, wParam, lParam);
			break;
		case ID_OPEN:
			bRet = OnFileOpen(hWnd, wParam, lParam);
			break;
		case ID_SAVE:
			bRet = OnFileSave(hWnd, wParam, lParam);
			break;
		case ID_SAVEAS:
			bRet = OnFileSaveAs(hWnd, wParam, lParam);
			break;
		case ID_PRINT:
			bRet = OnFilePrint(hWnd, wParam, lParam);
			break;
		case ID_PAGESET:
			bRet = OnPageSet(hWnd, wParam, lParam);
			break;
		case ID_COPY:
			bRet = OnFileCopy(hWnd, wParam, lParam);
			break;
		case ID_PASTE:
			bRet = OnFilePaste(hWnd, wParam, lParam);
			break;
		case ID_COLOR:
			bRet = OnColor(hWnd, wParam, lParam);
			break;
		case ID_FONT:
			bRet = OnFont(hWnd, wParam, lParam);
			break;
		default:
			return DefWindowProc(hWnd, uMsg, wParam, lParam);
	}

	return bRet;
}
示例#3
0
BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			return OnFileNew();
	case IDM_FILE_CLOSE:		return OnFileClose();
	case IDM_FILE_OPEN:			return OnFileOpen();
	case IDM_FILE_SAVE:			return OnFileSave();
	case IDM_FILE_SAVEAS:		return OnFileSave();
	case IDM_FILE_PRINT:		return OnFilePrint();
	case IDW_VIEW_STATUSBAR:	return OnViewStatusBar();
	case IDW_VIEW_TOOLBAR:		return OnViewToolBar();
	case IDW_MDI_ARRANGE:		return OnMDIIconArrange();
	case IDW_MDI_CASCADE:		return OnMDICascade();
	case IDW_MDI_CLOSEALL:		return OnMDICloseAll();
	case IDW_MDI_TILE:			return OnMDITile();
	case IDM_FILE_EXIT:			return OnFileExit();
	case IDM_HELP_ABOUT:		return OnHelp();
	default:    // Pass to active child...
		{
			if (GetActiveMDIChild())
				GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam);
		}
		break ;
	}
	return FALSE;
}
示例#4
0
BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:
		AddMDIChild(new CSimpleMDIChild); // CMDIFrame::RemoveMDIChild deletes this pointer
		return TRUE;
	case IDM_FILE_CLOSE:          // Close the active MDI window
		GetActiveMDIChild()->SendMessage(WM_CLOSE, 0, 0);
		return TRUE;
	case IDM_FILE_OPEN:
		OnFileOpen();
		return TRUE;
	case IDM_FILE_SAVE:
		OnFileSave();
    return TRUE;
	case IDM_FILE_SAVEAS:
		OnFileSaveAs();
    return TRUE;
	case IDM_FILE_PRINT:
		OnFilePrint();
		return TRUE;
	case IDW_VIEW_STATUSBAR:
		OnViewStatusbar();

		break;
	case IDW_VIEW_TOOLBAR:
		OnViewToolbar();
		break;
	case IDW_WINDOW_ARRANGE:
		::PostMessage (GetView()->GetHwnd(), WM_MDIICONARRANGE, 0L, 0L) ;
		break;
	case IDW_WINDOW_CASCADE:
		::PostMessage (GetView()->GetHwnd(), WM_MDICASCADE, 0L, 0L) ;
		break;
	case IDW_WINDOW_CLOSEALL:
		RemoveAllMDIChildren();
		break;
	case IDW_WINDOW_TILE:
		::PostMessage (GetView()->GetHwnd(), WM_MDITILE, 0L, 0L) ;
		break;
	default:    // Pass to active child...
		{
			if (GetActiveMDIChild())
				GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam);
		}
		break ;
	case IDM_FILE_EXIT:
		::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
		return TRUE;
	case IDM_HELP_ABOUT:
		OnHelp();
		return TRUE;
	}
	return FALSE;
}
示例#5
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
    // OnCommand responds to menu and and toolbar input
    UNREFERENCED_PARAMETER(lParam);

    switch (LOWORD(wParam)) {
    case IDM_FILE_OPEN:
        // Refer to the tutorial for an example of OnFileOpen
        OnFileOpen();
        return TRUE;

    case IDM_FILE_SAVE:
        // Refer to the tutorial for an example of OnFileSave
        OnFileSave();
        return TRUE;

    case IDM_FILE_SAVEAS:
        // Refer to the tutorial for an example of OnFileSaveAs
        OnFileSave();
        return TRUE;

    case IDM_FILE_PRINT:
        OnFilePrint();
        return TRUE;

    case IDM_FILE_EXIT:
        // End the application
        ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
        return TRUE;

    case IDW_VIEW_STATUSBAR:
        OnViewStatusBar();
        return TRUE;

    case IDW_VIEW_TOOLBAR:
        OnViewToolBar();
        return TRUE;

    case IDM_HELP_ABOUT:
        // Display the help dialog
        OnHelp();
        return TRUE;
    }

    return FALSE;
}
示例#6
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// OnCommand responds to menu and and toolbar input

	UNREFERENCED_PARAMETER(lParam);

	switch(LOWORD(wParam))
	{
	case IDM_FILE_OPEN:			return OnFileOpen();
	case IDM_FILE_SAVE:			return OnFileSave();
	case IDM_FILE_SAVEAS:		return OnFileSave();
	case IDM_FILE_PRINT:		return OnFilePrint();
	case IDM_FILE_EXIT:			return OnFileExit();
	case IDW_VIEW_STATUSBAR:	return OnViewStatusBar();
	case IDW_VIEW_TOOLBAR:		return OnViewToolBar();
	case IDM_HELP_ABOUT:		return OnHelp();
	}

	return FALSE;
}
示例#7
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// Process the messages from the (non-ribbon) Menu and Tool Bar

	UNREFERENCED_PARAMETER(lParam);

	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			OnFileNew();			return TRUE;
	case IDM_FILE_OPEN:			OnFileOpen();			return TRUE;
	case IDM_FILE_SAVE:			OnFileSave();			return TRUE;
	case IDM_FILE_SAVEAS:		OnFileSaveAs();			return TRUE;
	case IDM_FILE_PRINT:		OnFilePrint();			return TRUE;

	case IDM_FILE_EXIT:			OnFileExit();			return TRUE;
	case IDW_FILE_MRU_FILE1:
	case IDW_FILE_MRU_FILE2:
	case IDW_FILE_MRU_FILE3:
	case IDW_FILE_MRU_FILE4:
	case IDW_FILE_MRU_FILE5:
		{
			UINT uMRUEntry = LOWORD(wParam) - IDW_FILE_MRU_FILE1;
			MRUFileOpen(uMRUEntry);
			return TRUE;
		}

	case IDM_PEN_RED:	SetPenColor(RGB(255, 0, 0));	return TRUE;
	case IDM_PEN_BLUE:	SetPenColor(RGB(0, 0, 255));	return TRUE;
	case IDM_PEN_GREEN:	SetPenColor(RGB(0, 196, 0));	return TRUE;
	case IDM_PEN_BLACK:	SetPenColor(RGB(0, 0, 0));		return TRUE;
	
	case IDW_VIEW_STATUSBAR:	return OnViewStatusBar();
	case IDW_VIEW_TOOLBAR:		return OnViewToolBar();
	case IDM_HELP_ABOUT:		return OnHelp();

	}

	return FALSE;
}
示例#8
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// OnCommand responds to menu and and toolbar input

	UNREFERENCED_PARAMETER(lParam);

	switch(LOWORD(wParam))
	{
	case IDM_FILE_OPEN:			OnFileOpen();			return TRUE;
	case IDM_FILE_SAVE:			OnFileSave();			return TRUE;
	case IDM_FILE_SAVEAS:		OnFileSave();			return TRUE;
	case IDM_FILE_PRINT:		OnFilePrint();			return TRUE;
	case IDM_FILE_EXIT:			OnFileExit();			return TRUE;
	case IDW_VIEW_STATUSBAR:	OnViewStatusBar();		return TRUE;
	case IDW_VIEW_TOOLBAR:		OnViewToolBar();		return TRUE;
	case IDM_TOOLBAR_CUSTOMIZE:	OnTBCustomize();		return TRUE;
	case IDM_TOOLBAR_DEFAULT:	OnTBDefault();			return TRUE;
	case IDM_TOOLBAR_BIGICONS:	OnTBBigIcons();			return TRUE;
	case IDM_HELP_ABOUT:		OnHelp();				return TRUE;
	}

	return FALSE;
}
示例#9
0
STDMETHODIMP CMainFrame::Execute(UINT32 nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCmdExProp)
{
	// This function is called when a ribbon button is pressed. 
	// Refer to IUICommandHandler::Execute in the Windows 7 SDK documentation 

	if (UI_EXECUTIONVERB_EXECUTE == verb)
	{
		switch(nCmdID)
		{
		case IDC_CMD_NEW:		OnFileNew();		break;
		case IDC_CMD_OPEN:		OnFileOpen();		break;
		case IDC_CMD_SAVE:		OnFileSave();		break;
		case IDC_CMD_SAVE_AS:	OnFileSaveAs();		break;
		case IDC_CMD_PRINT:		OnFilePrint();		break;
		case IDC_CMD_COPY:		TRACE("Copy\n");	break;
		case IDC_CMD_CUT:		TRACE("Cut\n");		break;
		case IDC_CMD_PASTE:		TRACE("Paste\n");	break;
		case IDC_CMD_ABOUT:		OnHelp();			break;
		case IDC_CMD_EXIT:		OnFileExit();		break;
		case IDC_RICHFONT:		TRACE("Font dialog\n");		break;
		case IDC_RIBBONHELP:	OnHelp();					break;
		case IDC_MRULIST:		OnMRUList(key, ppropvarValue);		break;
		case IDC_PEN_COLOR:		OnPenColor(ppropvarValue, pCmdExProp);	break;
		case IDC_CUSTOMIZE_QAT:	TRACE("Customize Quick Access ToolBar\n");	break;
		default:
			{
				CString str;
				str.Format(_T("Unknown Button %d\n"),nCmdID);
				TRACE(str);
			}
			break;
		}
	}

	return S_OK;
}
示例#10
0
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);

	// Process the messages from the Menu and Tool Bar
	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:			OnFileNew();		return TRUE;
	case IDM_FILE_OPEN:			OnFileOpen();		return TRUE;
	case IDM_FILE_SAVE:			OnFileSave();		return TRUE;
	case IDM_FILE_SAVEAS:		OnFileSaveAs();		return TRUE;
	case IDM_FILE_PRINT:		OnFilePrint();		return TRUE;
	case IDM_PEN_RED:			OnPenRed();			return TRUE;
	case IDM_PEN_BLUE:			OnPenBlue();		return TRUE;
	case IDM_PEN_GREEN:			OnPenGreen();		return TRUE;
	case IDM_PEN_BLACK:			OnPenBlack();		return TRUE;
	case IDW_VIEW_STATUSBAR:	OnViewStatusBar();	return TRUE;
	case IDW_VIEW_TOOLBAR:		OnViewToolBar();	return TRUE;
	case IDM_HELP_ABOUT:		OnHelp();			return TRUE;
	case IDM_FILE_EXIT:			OnFileExit();		return TRUE;
	}

	return FALSE;
}