コード例 #1
0
ファイル: MainMDIfrm.cpp プロジェクト: the-reverend/Win32xx
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;
}
コード例 #2
0
ファイル: Mainfrm.cpp プロジェクト: the-reverend/Win32xx
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;
}
コード例 #3
0
ファイル: NotePad.cpp プロジェクト: DIOSZHOU/WndProject
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;
}
コード例 #4
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3MainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: OnFileNew(); break;
        case 1: OnFileEdit(); break;
        case 2: OnFileOpen(); break;
        case 3: OnFileSave(); break;
        case 4: OnFileConfig(); break;
        case 5: OnFileExit(); break;
        case 6: OnSimRun(); break;
        case 7: OnSimPause(); break;
        case 8: OnSimSkip(); break;
        case 9: OnSimStop(); break;
        case 10: OnNetInit(); break;
        case 11: OnNetClose(); break;
        case 12: OnNetServer(); break;
        case 13: OnNetServer((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 14;
    }
    return _id;
}
コード例 #5
0
void HtMainFrame::OnFileOpenDropDown (wxAuiToolBarEvent &event)
{
   if (event.IsDropDownClicked())
   {
      wxAuiToolBar *tb = static_cast<wxAuiToolBar *>(event.GetEventObject());
      tb->SetToolSticky(event.GetId(), true);

      wxMenu menuPopup;
      history.AddFilesToMenu(&menuPopup);

      // event handler to deal with the menu items
      const int start = history.GetBaseId();
      const int end = history.GetBaseId() + history.GetMaxFiles();

      Connect(start, end, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(HtMainFrame::OnRecentFilesSelected));

      // line up our menu with the button
      wxRect rect = tb->GetToolRect(event.GetId());
      wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
      pt = ScreenToClient(pt);

      PopupMenu(&menuPopup, pt);

      // make sure the button is "un-stuck"
      tb->SetToolSticky(event.GetId(), false);
   }
   else
   {
      wxCommandEvent dummy;
      OnFileOpen(dummy);
   }
}
コード例 #6
0
ファイル: main.cpp プロジェクト: Shell64/cgdemos
LRESULT CALLBACK ProcessCommand( WPARAM wParam )
{
	switch ( wParam )
	{
	case IDM_FILE_OPEN:
		OnFileOpen( );
		break;
	case  IDM_FILE_SAVE:
		break;
	case IDM_FILE_EXIT:
		ShutDown();
		break;
	case IDM_TOOLS_MOVE:
		//g_pDisplayWidget->SetState( DWS_MOVE );
		break;
	case  IDM_TOOLS_ZOOM:
		//g_pDisplayWidget->SetState( DWS_ZOOM );
		break;
	case ID_GEODESICMATTING_FORE:
		break;
	case ID_GEODESICMATTING_BACK:
		break;
	case ID_GEODESICMATTING_DONE:
		break;
	default:
		break;
	}
	return 0;
}
コード例 #7
0
void OnCommand(HWND hwnd, int id, HWND /*hwndCtl*/, UINT /*codeNotify*/)
{
    switch (id)
    {
    case ID_FILE_OPENFILE:
        OnFileOpen(hwnd);
        break;
    }
}
コード例 #8
0
ファイル: SQLiteViewer.cpp プロジェクト: trident99/SqLiteStar
//!Initialize the Menu
void SQLiteViewer::InitializeMenu(void)
{
	connect(ui.actionOpen_DB,SIGNAL(triggered()),this,SLOT(OnFileOpen()));
	connect(ui.actionClose_DB,SIGNAL(triggered()),this,SLOT(OnFileClose()));

	connect(ui.actionCreate_DemoDB01,SIGNAL(triggered()),this,SLOT(OnCreateDemoDB01()));
	connect(ui.actionCreate_DemoDB02,SIGNAL(triggered()),this,SLOT(OnCreateDemoDB02()));
	connect(ui.actionCreate_DemoDB03,SIGNAL(triggered()),this,SLOT(OnCreateDemoDB03()));
};
コード例 #9
0
ファイル: MainMDIfrm.cpp プロジェクト: goofoo/Helium
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;
}
コード例 #10
0
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
    case WM_CREATE:
        return OnCreateWindow(hwnd);

    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case IDM_EXIT:
            DestroyWindow(hwnd);
            break;
        case ID_FILE_OPENFILE:
            OnFileOpen(hwnd);
            break;
        case ID_FILE_OPENURL:
            OnOpenURL(hwnd);
            break;

        default:
            return DefWindowProc(hwnd, message, wParam, lParam);
        }
        break;

    case WM_PAINT:
        OnPaint(hwnd);
        break;

    case WM_SIZE:
        OnResize(LOWORD(lParam), HIWORD(lParam));
        break;

    case WM_ERASEBKGND:
        // Suppress window erasing, to reduce flickering while the video is playing.
        return 1;

    case WM_DESTROY:
        PostQuitMessage(0);
        break;

    case WM_CHAR:
        OnKeyPress(wParam);
        break;

    case WM_APP_PLAYER_EVENT:
        OnPlayerEvent(hwnd, wParam);
        break;

    default:
        return DefWindowProc(hwnd, message, wParam, lParam);
    }
    return 0;
}
コード例 #11
0
ファイル: Mainfrm.cpp プロジェクト: wyrover/win32-framework
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;
}
コード例 #12
0
ファイル: FileTreeCtrl.cpp プロジェクト: 5432935/genesis3d
void CTreeFileCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) 
{
  HTREEITEM hItem = GetSelectedItem();
  CPoint pt = GetCurrentMessage()->pt;
  ScreenToClient(&pt);

	if (hItem && (hItem == HitTest(pt)))
	{
		TV_ITEM tvi;
		ZeroMemory(&tvi, sizeof(TVITEM));
		tvi.mask = TVIF_CHILDREN;
		tvi.hItem = hItem;
		if (GetItem(&tvi) && tvi.cChildren == 0)
			OnFileOpen();
	}
	
	*pResult = 0;
}
コード例 #13
0
ファイル: Mainfrm.cpp プロジェクト: GlPortal/Update-Installer
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// Process the messages from the Menu and Tool Bar
	switch (LOWORD(wParam))
	{
	case IDM_FILE_NEW:
		m_View.ClearPoints();
		m_PathName = _T("");
		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:
		::MessageBox(NULL, _T("File Print Implemented Later"), _T("Menu"), MB_OK);
		return TRUE;
	case IDM_PEN_RED:
		m_View.SetPen(RGB(255,0,0));
		return TRUE;
	case IDM_PEN_BLUE:
		m_View.SetPen(RGB(0,0,255));
		return TRUE;
	case IDM_PEN_GREEN:
		m_View.SetPen(RGB(0,196,0));
		return TRUE;
	case IDM_PEN_BLACK:
		m_View.SetPen(RGB(0,0,0));
		return TRUE;
	case IDM_HELP_ABOUT:
		OnHelp();
		return TRUE;
	case IDM_FILE_EXIT:
		::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
		return TRUE;
	}

	return FALSE;
}
コード例 #14
0
ファイル: Mainfrm.cpp プロジェクト: the-reverend/Win32xx
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;
}
コード例 #15
0
ファイル: Mainfrm.cpp プロジェクト: the-reverend/Win32xx
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;
}
コード例 #16
0
ファイル: Mainfrm.cpp プロジェクト: quinsmpang/Tools
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;
}
コード例 #17
0
ファイル: Mainfrm.cpp プロジェクト: quinsmpang/Tools
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;
}
コード例 #18
0
ファイル: MainWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 显示主窗口,并建立消息循环,等待运行完成
VOID CMainWnd::Show(PCTSTR ptzCmdLine, INT iCmdShow)
{
	MSG msgMsg;
	HACCEL hAccel;

	// 显示主窗口
	if (iCmdShow <= SW_NORMAL)
	{
		iCmdShow = _Bound(CIni::GetInt(INI_WindowState), SW_NORMAL, SW_MAX);
	}
	ShowWindow(m_hWnd, iCmdShow);

	// 载入菜单加速键
	hAccel = LoadAccelerators(g_hInst, MAKEINTRESOURCE(IDR_Accel));

	// 处理命令行
	if (ptzCmdLine && ptzCmdLine[0])
	{
		OnFileOpen(ptzCmdLine);
	}
	else if (CIni::GetInt(INI_ShowOpen))
	{
		PostMessage(m_hWnd, WM_COMMAND, IDM_File_Open, 0);
	}

	// 消息循环
	while (GetMessage(&msgMsg, NULL, 0, 0))
	{
		if ((TranslateMDISysAccel(CClientWnd::m_hWnd, &msgMsg) == 0) &&
			(TranslateAccelerator(m_hWnd, hAccel, &msgMsg) == 0))
		{
			TranslateMessage(&msgMsg);
			DispatchMessage(&msgMsg);
		}
	}
}
コード例 #19
0
ファイル: Mainfrm.cpp プロジェクト: the-reverend/Win32xx
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;
}
コード例 #20
0
ファイル: MainWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 回调函数
LRESULT CALLBACK CMainWnd::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	CChildWnd *pWnd;
	TCHAR tzTemp[MAX_PATH];

	switch (uMsg)
	{
	case WM_CREATE:
		// 窗口被创建
		m_hWnd = hWnd;
		m_hMenu = GetMenu(m_hWnd);
		OnCreate();
		break;

	case WM_SIZE:
		// 尺寸改变
		OnSize(wParam, lParam);
		return 0;

	case WM_WINDOWPOSCHANGED:
		// 位置改变
		for (pWnd = CChildWnd::m_pHead; pWnd; pWnd = pWnd->m_pNext)
		{
			if (pWnd->m_hWnd)
			{
				pWnd->SetDrawRect();
			}
		}
		break;

	case WM_INITMENUPOPUP:
		// 弹出菜单初始化
		OnMenuPopup(wParam, lParam);
		break;

	case WM_MENUSELECT:
		// 菜单项被选择
		OnMenuSelect(LOWORD(wParam));
		break;

	case WM_EXITMENULOOP:
		// 退出菜单循环
		CClientWnd::SetStatusText(LNG_Ready);
		break;

	case WM_COMMAND:
		// 命令处理
		OnCommand(wParam, lParam);
		break;

	case WM_COPYDATA:
		// 本程序的其它实例通知打开文件
		if (((PCOPYDATASTRUCT) lParam)->dwData == IDM_File_Open)
		{
			static TCHAR s_tzFileName[MAX_PATH];

			lstrcpyn(s_tzFileName, (PTSTR) ((PCOPYDATASTRUCT) lParam)->lpData, MAX_PATH);
			PostMessage(m_hWnd, WM_COMMAND, IDM_File_Open, (LPARAM) s_tzFileName);
		}
		break;

	case WM_HOTKEY:
		// 热键消息
		if ((m_hWnd != GetForegroundWindow()) && (wParam == IDC_TrayIcon))
		{
			OnTrayIcon(FALSE);
		}
		break;

	case WM_DROPFILES:
		// 拖动文件
		DragQueryFile((HDROP) wParam, 0, tzTemp, MAX_PATH);
		DragFinish((HDROP) wParam);
		OnFileOpen(tzTemp);
		break;

	case WM_HELP:
		// 帮助
		OnCommand(IDM_Help_Content);
		break;

	case WM_DESTROY:
		// 窗口被销毁
		OnDestroy();
		break;
	}

	return DefFrameProc(hWnd, CClientWnd::m_hWnd, uMsg, wParam, lParam);
}
コード例 #21
0
LRESULT MainWindow::OnReceiveMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;

	HRESULT hr;

	switch (message)
	{

	case WM_CREATE:
		hr = OnCreate();
		if (FAILED(hr))
		{
			// Fail and quit.
			NotifyError(m_hwnd, TEXT("Cannot initialize the application."), hr);
			return -1;
		}
		break;
		
	case WM_SIZE:
		OnSize();
		break;

	case WM_PAINT:
		OnPaint();
		break;

	case WM_MOVE:
		OnPaint();
		break;

	case WM_DISPLAYCHANGE:
		m_pPlayer->DisplayModeChanged();
		break;

	case WM_ERASEBKGND:
		return 1;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	case WM_TIMER:
		OnTimer();
		break;

	case WM_NOTIFY:
        OnWmNotify((NMHDR*)lParam);
		break;

	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);
		switch (wmId)
		{
		case IDM_EXIT:
			DestroyWindow(m_hwnd);
			break;

		case ID_FILE_OPENFILE:
			OnFileOpen();
			break;

		case IDC_BUTTON_PLAY:
			OnPlay();
			break;

		case IDC_BUTTON_STOP:
			OnStop();
			break;

		case IDC_BUTTON_PAUSE:
			OnPause();
			break;
	
		case IDC_BUTTON_MUTE:
			OnMute();
			break;
		}
		break;

    // Private filter graph message.
	case WM_GRAPH_EVENT:
		hr = m_pPlayer->HandleGraphEvent(this);
		break;

	default:
		return BaseWindow::OnReceiveMessage(message, wParam, lParam);
	}
	return 0;
}
コード例 #22
0
void CMainFrame::OnFileOpenPanel0() {
  OnFileOpen(0);
}
コード例 #23
0
ファイル: MainWnd.cpp プロジェクト: Yonsm/RawPlayer
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 命令处理
VOID CMainWnd::OnCommand(WPARAM wParam, LPARAM lParam)
{
	PTSTR p;
	DWORD dwSize;
	CChildWnd *pWnd;	
	TCHAR tzTemp[512];
	TCHAR tzPath[512];

	if ((LOWORD(wParam) >= IDM_View_Default) && (LOWORD(wParam) < IDM_View_Default + 50))
	{
		// 改变语言
		if (IsMenuChecked(LOWORD(wParam)) == FALSE)
		{
			OnViewLanguage(LOWORD(wParam));
		}
		return;
	}
	else if ((LOWORD(wParam) >= IDM_File_Recent) && (LOWORD(wParam) < IDM_File_Recent + 10))
	{
		// 打开新近文件
		GetMenuString(m_hMenu, LOWORD(wParam), tzTemp, _NumOf(tzTemp), MF_BYCOMMAND);
		OnFileOpen(tzTemp + 4);
		return;
	}

	switch (LOWORD(wParam))
	{
	case IDM_File_Open:
		OnFileOpen((PTSTR) lParam);
		break;

	case IDM_File_Exit:
		PostMessage(m_hWnd, WM_CLOSE, 0, 0);
		break;

	case IDM_View_Toolbar:
	case IDM_View_StatusBar:
	case IDM_View_AlwaysOnTop:
	case IDM_View_MinToTray:
	case IDM_View_ShowSplash:
	case IDM_View_ShowOpen:
	case IDM_View_PlayOnOpen:
		// 查看选项
		OnViewMenu(LOWORD(wParam), FALSE);
		break;

	case IDM_View_AssociateFile:
		GetModuleFileName(NULL, tzPath, MAX_PATH);
		wsprintf(tzTemp, TEXT("\"%s\" \"%%1\""), tzPath);
		dwSize = _NumOf(tzPath);
		SHGetValue(HKEY_CLASSES_ROOT, STR_AppName TEXT("\\shell\\open\\command"), NULL, NULL, tzPath, &dwSize);
		if (lstrcmpi(tzTemp, tzPath) == 0)
		{
			SHDeleteKey(HKEY_CLASSES_ROOT, STR_AppName);

			for (p = STR_ExtList; *p; p += lstrlen(p) + 1)
			{
				SHDeleteKey(HKEY_CLASSES_ROOT, p);
			}
		}
		else
		{
			SHSetValue(HKEY_CLASSES_ROOT, 
				STR_AppName TEXT("\\shell\\open\\command"), NULL, REG_SZ, tzTemp, _StrSize(tzTemp));

			GetModuleFileName(NULL, tzPath, MAX_PATH);
			wsprintf(tzTemp, TEXT("\"%s\",1"), tzPath);
			SHSetValue(HKEY_CLASSES_ROOT, STR_AppName TEXT("\\DefaultIcon"), NULL, REG_SZ, tzTemp, _StrSize(tzTemp));

			for (p = STR_ExtList; *p; p += lstrlen(p) + 1)
			{
				SHSetValue(HKEY_CLASSES_ROOT, p, NULL, REG_SZ, STR_AppName, sizeof(STR_AppName));
			}
		}
		break;

	case IDM_Window_Cascade:
		SendMessage(CClientWnd::m_hWnd, WM_MDICASCADE, 0, 0);
		return;

	case IDM_Window_TitleHorz:
		SendMessage(CClientWnd::m_hWnd, WM_MDITILE, MDITILE_HORIZONTAL, 0);
		break;

	case IDM_Window_TitleVert:
		SendMessage(CClientWnd::m_hWnd, WM_MDITILE, MDITILE_VERTICAL, 0);
		break;

	case IDM_Window_ArrangeIcons:
		SendMessage(CClientWnd::m_hWnd, WM_MDIICONARRANGE, 0, 0);
		break;

	case IDM_Window_CloseAll:
		CClientWnd::CloseAll();
		break;

	case IDM_Help_Content:
		// 查看帮助内容
		GetModuleFileName(NULL, tzTemp, MAX_PATH);
		lstrcpy(_StrEnd(tzTemp) - _LenOf(EXT_Chm), EXT_Chm);
		if (ShellExecute(NULL, NULL, tzTemp, NULL, NULL, SW_SHOW) <= (HINSTANCE) 32)
		{
			ErrorBox(ERR_HelpErr);
		}
		break;

	case IDM_Help_Desktop:
	case IDM_Help_StartMenu:
	case IDM_Help_ProgramMenu:
	case IDM_Help_QuickLaunch:
	case IDM_Help_VisualStudio:
		// 创建或删除快捷方式
		OnHelpShortcut(LOWORD(wParam));
		break;

	case IDM_Help_About:
		// 显示关于对话框
		CAboutDlg::Show(m_hWnd);
		break;

	case IDC_TrayIcon:
		// 系统托盘消息
		if ((lParam == WM_LBUTTONUP) || (lParam == WM_RBUTTONUP))
		{
			OnTrayIcon(FALSE);
		}
		break;

	default:
		pWnd = CClientWnd::GetChildWnd();
		_ExIf(pWnd, pWnd->OnCommand(wParam, lParam));
	}
}
コード例 #24
0
void CMainFrame::OnFileOpenPanel1() {
  OnFileOpen(1);
}
コード例 #25
0
ファイル: MainWindow.cpp プロジェクト: PennTao/GrooveNet
MainWindow::MainWindow()
    : QMainWindow( 0, "MainWindow", WDestructiveClose )
{
	QDockWindow * pNMWindow;
	std::map<QString, ServerCreator>::iterator iterCreator;

	m_pCentralWidget = new QWorkspace(this, "CENTRALWIDGET");
	m_pCentralWidget->setScrollBarsEnabled(true);

	setIcon(app32x32_xpm);

	setCentralWidget(m_pCentralWidget);

	// create menus
	m_pFileMenu = new QPopupMenu(this, "File Menu");
	m_pFileNew = new QAction("&New...", QAccel::stringToKey("Ctrl+N"), this, "file.new");
	m_pFileNew->setToolTip("Create a new simulation file, ending the current simulation");
	connect(m_pFileNew, SIGNAL(activated()), this, SLOT(OnFileNew()));
	m_pFileNew->addTo(m_pFileMenu);
	m_pFileEdit = new QAction("&Edit...", QAccel::stringToKey("Ctrl+E"), this, "file.edit");
	m_pFileEdit->setToolTip("Edit the current simulation file, ending the current simulation");
	connect(m_pFileEdit, SIGNAL(activated()), this, SLOT(OnFileEdit()));
	m_pFileEdit->setEnabled(false);
	m_pFileEdit->addTo(m_pFileMenu);
	m_pFileOpen = new QAction(QPixmap(fileopen), "&Open...", QAccel::stringToKey("Ctrl+O"), this, "file.open");
	m_pFileOpen->setToolTip("Open a simulation file, ending the current simulation");
	connect(m_pFileOpen, SIGNAL(activated()), this, SLOT(OnFileOpen()));
	m_pFileOpen->addTo(m_pFileMenu);
	m_pFileSave = new QAction(QPixmap(filesave), "&Save As...", QAccel::stringToKey("Ctrl+S"), this, "file.save");
	m_pFileSave->setToolTip("Save the current setup to a simulation file (this ends any running simulation)");
	connect(m_pFileSave, SIGNAL(activated()), this, SLOT(OnFileSave()));
	m_pFileSave->setEnabled(false);
	m_pFileSave->addTo(m_pFileMenu);
	m_pFileMenu->insertSeparator();
	m_pFileConfig = new QAction("&Configure...", QKeySequence(), this, "file.config");
	m_pFileConfig->setToolTip("Edit the current configuration");
	connect(m_pFileConfig, SIGNAL(activated()), this, SLOT(OnFileConfig()));
	m_pFileConfig->addTo(m_pFileMenu);
	m_pFileExit = new QAction("E&xit...", QAccel::stringToKey("Ctrl+Q"), this, "file.exit");
	m_pFileExit->setToolTip("Exit the program");
	connect(m_pFileExit, SIGNAL(activated()), this, SLOT(OnFileExit()));
	m_pFileExit->addTo(m_pFileMenu);

	m_pSimMenu = new QPopupMenu(this, "Sim Menu");
	m_pSimRun = new QAction("&Run...", QKeySequence(Qt::Key_F2), this, "sim.run");
	m_pSimRun->setToolTip("Start a new simulation");
	connect(m_pSimRun, SIGNAL(activated()), this, SLOT(OnSimRun()));
	m_pSimRun->setEnabled(false);
	m_pSimRun->addTo(m_pSimMenu);
	m_pSimPause = new QAction("Pause", QKeySequence(Qt::Key_F3), this, "sim.pause");
	m_pSimPause->setToolTip("Pause the currently running simulation");
	m_pSimPause->setEnabled(false);
	connect(m_pSimPause, SIGNAL(activated()), this, SLOT(OnSimPause()));
	m_pSimPause->addTo(m_pSimMenu);
	m_pSimSkip = new QAction("Skip to next", QKeySequence(), this, "sim.skip");
	m_pSimSkip->setToolTip("Skip to the next Monte Carlo iteration of the simulation");
	m_pSimSkip->setEnabled(false);
	connect(m_pSimSkip, SIGNAL(activated()), this, SLOT(OnSimSkip()));
	m_pSimSkip->addTo(m_pSimMenu);
	m_pSimStop = new QAction("&Stop", QKeySequence(Qt::SHIFT | Qt::Key_F2), this, "sim.stop");
	m_pSimStop->setToolTip("Stop the currently running simulation");
	m_pSimStop->setEnabled(false);
	connect(m_pSimStop, SIGNAL(activated()), this, SLOT(OnSimStop()));
	m_pSimStop->addTo(m_pSimMenu);

	m_pNetMenu = new QPopupMenu(this, "Net Menu");
	m_pNetInit = new QAction("&Initialize", QKeySequence(), this, "net.init");
	m_pNetInit->setToolTip("Initialize network devices and connections");
	m_pNetInit->setEnabled(true);
	connect(m_pNetInit, SIGNAL(activated()), this, SLOT(OnNetInit()));
	m_pNetInit->addTo(m_pNetMenu);
	m_pNetClose = new QAction("&Close", QKeySequence(), this, "net.close");
	m_pNetClose->setToolTip("Close network devices and connections");
	m_pNetClose->setEnabled(false);
	connect(m_pNetClose, SIGNAL(activated()), this, SLOT(OnNetClose()));
	m_pNetClose->addTo(m_pNetMenu);
	m_pNetServer = new QAction("&Stop Server", QKeySequence(), this, "net.server");
	m_pNetServer->setToolTip("Stop GrooveNet server");
	connect(m_pNetServer, SIGNAL(activated()), this, SLOT(OnNetServer()));
	m_pNetServerMenu = new QPopupMenu(this, "startserver");
	connect(m_pNetServerMenu, SIGNAL(activated(int)), this, SLOT(OnNetServer(int)));
	for (iterCreator = g_mapServerCreators.begin(); iterCreator != g_mapServerCreators.end(); ++iterCreator)
		m_pNetServerMenu->insertItem(iterCreator->first);
	m_iNetServerMenuID = m_pNetMenu->insertItem("&Start Server", m_pNetServerMenu);

	m_pWindowMenu = new QPopupMenu(this, "Window Menu");
	m_pWindowCascade = new QAction("&Cascade", QKeySequence(), this, "window.cascade");
	m_pWindowCascade->setToolTip("Cascade all open windows");
	connect(m_pWindowCascade, SIGNAL(activated()), m_pCentralWidget, SLOT(cascade()));
	m_pWindowCascade->addTo(m_pWindowMenu);
	m_pWindowTile = new QAction("&Tile", QKeySequence(), this, "window.tile");
	m_pWindowTile->setToolTip("Tile all open windows");
	connect(m_pWindowTile, SIGNAL(activated()), m_pCentralWidget, SLOT(tile()));
	m_pWindowTile->addTo(m_pWindowMenu);
	m_pWindowCloseAll = new QAction("Close &All Windows", QKeySequence(), this, "window.closeall");
	m_pWindowCloseAll->setToolTip("Close all open windows");
	connect(m_pWindowCloseAll, SIGNAL(activated()), m_pCentralWidget, SLOT(closeAllWindows()));
	m_pWindowCloseAll->addTo(m_pWindowMenu);

	menuBar()->insertItem("&File", m_pFileMenu);
	menuBar()->insertItem("&Simulator", m_pSimMenu);
	menuBar()->insertItem("&Network", m_pNetMenu);
	menuBar()->insertItem("&Window", m_pWindowMenu);

	statusBar()->addWidget(m_pLblStatus = new QLabel("Ready", this, "statusbar.label"), 1);
	statusBar()->setSizeGripEnabled(true);

/*	pNMWindow = new QDockWindow(this);
	pNMWindow->setCaption("Network Manager");
	pNMWindow->setHorizontallyStretchable(true);
	pNMWindow->setVerticallyStretchable(false);
	pNMWindow->setResizeEnabled(true);
	pNMWindow->setMovingEnabled(true);
	pNMWindow->setCloseMode(QDockWindow::Always);
	m_pNetworkManager = new QNetworkManager(pNMWindow, "network manager");
	pNMWindow->setWidget(m_pNetworkManager);
	addDockWindow(pNMWindow, Qt::DockBottom, true);
*/
        tabsContainer = new QToolBar(this);
        tabsWidget = new QTabWidget(tabsContainer, "tabs");
        tabsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
        tabsWidget->setMargin(8);

        tabsContainer->setStretchableWidget(tabsWidget);
        tabsContainer->setLabel(tr("GrooveNet - Tooltabs"));
        addDockWindow(tabsContainer, Qt::DockBottom, TRUE);
        m_pNetworkManager = new QNetworkManager(tabsContainer, "network manager");
        tabsWidget->addTab(m_pNetworkManager, QString("Network Manager"));
	m_pMessageList = new QMessageList(tabsContainer, "message list");
        tabsWidget->addTab(m_pMessageList, QString("Messages"));
        setAppropriate(tabsContainer, false);
        tabsWidget->addTab(NULL, QString("Congestion Info"));
        tabsWidget->addTab(NULL, QString("Playback"));
}
コード例 #26
0
ファイル: wed.cpp プロジェクト: akavel/wed-editor
void 	CWedApp::OpenFile()
{
	OnFileOpen();
}
コード例 #27
0
ファイル: FileTreeCtrl.cpp プロジェクト: 5432935/genesis3d
BOOL CTreeFileCtrl::PreTranslateMessage(MSG* pMsg) 
{
  // When an item is being edited make sure the edit control
  // receives certain important key strokes
  if (GetEditControl())
  {
    ::TranslateMessage(pMsg);
    ::DispatchMessage(pMsg);
    return TRUE; // DO NOT process further
  }

  //Context menu via the keyboard
	if ((((pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) && // If we hit a key and
    	(pMsg->wParam == VK_F10) && (GetKeyState(VK_SHIFT) & ~1)) != 0) ||   // it's Shift+F10 OR
		  (pMsg->message == WM_CONTEXTMENU))						                   	   // Natural keyboard key
	{
		CRect rect;
		GetItemRect(GetSelectedItem(), rect, TRUE);
		ClientToScreen(rect);
		OnContextMenu(NULL, rect.CenterPoint());
		return TRUE;
	}
  //Hitting the Escape key, Cancelling drag & drop
	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE && IsDragging())
  {
    EndDragging(TRUE);
    return TRUE;
  }
  //Hitting the Alt-Enter key combination, show the properties sheet 
	else if (pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_RETURN)
  {
    OnFileProperties();
    return TRUE;
  }
  //Hitting the Enter key, open the item
	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
  {
    OnFileOpen();
    return TRUE;
  }
  //Hitting the delete key, delete the item
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE)
  {
    OnFileDelete();
    return TRUE;
  }
  //hitting the backspace key, go to the parent folder
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_BACK)
  {
    UpOneLevel();
    return TRUE;
  }
  //hitting the F2 key, being in-place editing of an item
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F2)
  {
    OnFileRename();
    return TRUE;
  }
  //hitting the F5 key, force a refresh of the whole tree
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F5)
  {
    OnViewRefresh();
    return TRUE;
  }

  //Let the parent class do its thing
	return CTreeCtrl::PreTranslateMessage(pMsg);
}
コード例 #28
0
long CMainWindow::OnCommand(unsigned short nID, unsigned short nCmd, HWND hControl)
{
	if(!IsWindowEnabled(m_hWnd))
	{
		return TRUE;
	}

	switch(nID)
	{
	case ID_FILE_ABOUT:
		OnAbout();
		break;
	case ID_FILE_ENABLEREVERB:
		OnClickReverbEnabled();
		break;
	case ID_FILE_EXIT:
		DestroyWindow(m_hWnd);
		break;
	case ID_FILE_NEXTTRACK:
		OnNext();
		break;
	case ID_FILE_PREVIOUSTRACK:
		OnPrev();
		break;
	case IDC_PAUSE_BUTTON:
	case ID_FILE_PAUSE:
		OnPause();
		break;
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 0:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 1:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 2:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 3:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 4:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 5:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 6:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 7:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 8:
	case ID_FILE_AUDIOPLUGIN_PLUGIN_0 + 9:
		ChangeAudioPlugin(nID - ID_FILE_AUDIOPLUGIN_PLUGIN_0);
		break;
	case ID_FILE_CHARENCODING_ENCODING_0 + 0:
	case ID_FILE_CHARENCODING_ENCODING_0 + 1:
	case ID_FILE_CHARENCODING_ENCODING_0 + 2:
	case ID_FILE_CHARENCODING_ENCODING_0 + 3:
	case ID_FILE_CHARENCODING_ENCODING_0 + 4:
	case ID_FILE_CHARENCODING_ENCODING_0 + 5:
	case ID_FILE_CHARENCODING_ENCODING_0 + 6:
	case ID_FILE_CHARENCODING_ENCODING_0 + 7:
	case ID_FILE_CHARENCODING_ENCODING_0 + 8:
	case ID_FILE_CHARENCODING_ENCODING_0 + 9:
		ChangeCharEncoding(nID - ID_FILE_CHARENCODING_ENCODING_0);
		break;
	case IDC_CONFIG_BUTTON:
		OnConfig();
		break;
	case IDC_LOOPMODE_BUTTON:
		OnRepeat();
		break;
	case IDC_PREVTAB_BUTTON:
		OnPrevPanel();
		break;
	case IDC_NEXTTAB_BUTTON:
		OnNextPanel();
		break;
	case IDC_EJECT_BUTTON:
		OnFileOpen();
		break;
	}
	return TRUE;
}