示例#1
0
/**
* OnUpgradeAvailable
*
* Description: called by ID_UPGRADE_AVAILABLE message when update is detected. 
*   Adds an update menu item.
*/
LRESULT CMainFrame::OnUpgradeAvailable(WPARAM wParam, LPARAM lParam)
{
	CConnectionListView * connectionView = (CConnectionListView *)m_mainSplitter.GetPane(0,0);

	// update menu
	CMenu contextMenu;
	CMenu *tracker; 
	contextMenu.LoadMenu(IDR_MAINFRAME);  

	contextMenu.AppendMenuW(MF_STRING, ID_UPGRADE_APP, _T("Upgrade Now!"));

	// Recreate menu with new items
	m_wndMenuBar.CreateFromMenu( contextMenu, false, true);

	/*
	int c = contextMenu.GetMenuItemCount();
	for(int i = 0; i < c; i++){
		CString label(_T(""));
		contextMenu.GetMenuStringW(i, label, MF_BYPOSITION);
		if(label.Compare(_T("&Help")) == 0){
			tracker = contextMenu.GetSubMenu(i);
			//int c2 = tracker->GetMenuItemCount();
			//tracker->AppendMenuW(MF_STRING, ID_UPGRADE_APP, _T("Upgrade Now!"));
			contextMenu.AppendMenuW(MF_STRING, ID_UPGRADE_APP, _T("Upgrade Now!"));
			// Recreate menu with new items
			m_wndMenuBar.CreateFromMenu( contextMenu, false, true);
		}
	}
	*/
	return 1;
}
示例#2
0
void CDeskTopDlg::OnRButtonUp(UINT nFlags, CPoint point)
{
	CMenu Menu;
	Menu.CreatePopupMenu();
	Menu.AppendMenuW(MF_STRING,600,L"刷新(&E)");
	Menu.AppendMenuW(MF_STRING,650,L"屏幕分辨率(&R)");
	Menu.AppendMenuW(MF_STRING,700,L"个性化(&R)");

	CMenu subMenu;
	subMenu.CreatePopupMenu();
	subMenu.AppendMenu(MF_STRING,800,L"新建文件夹(&F)");

	Menu.AppendMenu(MF_BYPOSITION|MF_POPUP|MF_STRING,(UINT_PTR)(subMenu.m_hMenu),L"新建(&W)");

	::TrackPopupMenu(Menu.m_hMenu,TPM_LEFTALIGN|TPM_TOPALIGN,point.x,point.y,0,m_hWnd,NULL);

	CDialog::OnRButtonUp(nFlags, point);
}
示例#3
0
文件: MainFrm.cpp 项目: cgwu/c_cpp
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// 创建一个视图以占用框架的工作区
	if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
		CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
	{
		TRACE0("未能创建视图窗口\n");
		return -1;
	}
	// 修改系统菜单
	CMenu *pSystemMenu = GetSystemMenu(FALSE);
	pSystemMenu->AppendMenuW(MF_SEPARATOR);
	pSystemMenu->AppendMenuW(MF_STRING, ID_APP_ABOUT,_T("关于我(&A)"));
	return 0;
}
示例#4
0
void CNPBPSType1Grid::InitMenu()
{
	CMenu submenu;
	CMenu * menu = GetPopupMenu();
	
	EnableMenu(TRUE);
	
	menu->AppendMenuW(MF_STRING|MF_UNCHECKED,2001,_T("Filter"));
	
	
	submenu.CreatePopupMenu();
}
示例#5
0
文件: MainFrm.cpp 项目: takke/MZ3
/**
 * メニュー押下(メインメニュー表示)
 */
void CMainFrame::OnMenuOpenMenu()
{
	POINT pt    = util::GetPopupPosForSoftKeyMenu1();
	int   flags = util::GetPopupFlagsForSoftKeyMenu1();

	CMenu menu;
#ifdef BT_TKTW
	menu.LoadMenu(IDR_MAINFRAME_CE_TKTW);
#endif
#ifdef BT_MZ3
	menu.LoadMenu(IDR_MAINFRAME_CE);
#endif
	CMenu* pSubMenu = menu.GetSubMenu(0);

	CView* pActiveView = GetActiveView();

	// カテゴリ差し替え
	const int IDX_CATEGOGY_MENU = 2;
	if (pActiveView == theApp.m_pMainView) {
		// メインビュー
		CMenu* pCategoryMenu = pSubMenu->GetSubMenu(IDX_CATEGOGY_MENU);
		if (pCategoryMenu != NULL) {
			// ダミー削除
			pCategoryMenu->DeleteMenu(ID_DUMMY, MF_BYCOMMAND);

			// カテゴリ選択メニュー追加
			const CCategoryItemList& categories = theApp.m_pMainView->m_selGroup->categories;
			for (size_t i=0; i<categories.size(); i++) {
				int mflag = MF_STRING;

				if (i == theApp.m_pMainView->m_selGroup->selectedCategory) {
					mflag |= MF_CHECKED;
				}
				pCategoryMenu->AppendMenuW(mflag, ID_SELECT_CATEGORY_BASE + i, categories[i].m_name);
			}
		}
	} else {
		// メインビュー以外:非表示
		pSubMenu->DeleteMenu(IDX_CATEGOGY_MENU, MF_BYPOSITION);
	}

	// メニュー表示
	pSubMenu->TrackPopupMenu(flags, pt.x, pt.y, this);
}