Ejemplo n.º 1
0
BOOL CClientDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
// 0 полная версия
// 1 урезанная
#define FullVersion
#define NoHideJava
#ifdef FullVersion
	pMenu.LoadMenuW(IDR_MENU1);
#else
	pMenu.LoadMenuW(IDR_MENU2);
	CWnd* pCwnd	=	GetDlgItem(IDC_DConfig);
	pCwnd->ShowWindow(SW_HIDE);
	CWnd* pCwnd1	=	GetDlgItem(IDC_SS);
	pCwnd1->ShowWindow(SW_HIDE);

#endif
	SetMenu(&pMenu);

	hF4 = LoadAccelerators( AfxGetResourceHandle(),
	MAKEINTRESOURCE( IDR_ACCELERATOR1 ) );

	m_TextWinList1.SetItemHeight(10);
	m_TextWinList1.SetBg(RGB(50,  100, 150));
	m_TextWinList1.SetFg(RGB(255, 255,255));

	m_PlaceKeeper.Init( m_hWnd );
	m_PlaceKeeper.SetBindings( IDC_CLIENTVIEW, CRect( TA_LEFT, TA_TOP, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_LOG_LIST, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_WINDOW_LIST, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_LIST1, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_REFRESH_BTN, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_REFRESHWND_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_PROCDLG_BTN, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_HOOK_APP, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_HOOK_JAVA, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_PATCH_STATUS, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_STATUS, CRect( TA_LEFT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC1, CRect( TA_LEFT, TA_BOTTOM, TA_LEFT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC2, CRect( TA_RIGHT, TA_BOTTOM, TA_RIGHT, TA_BOTTOM ) );
	m_PlaceKeeper.SetBindings( IDC_CMD_DESK_1, CRect(  TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );
	m_PlaceKeeper.SetBindings( IDC_CMD_DESK_2, CRect(  TA_LEFT, TA_TOP, TA_LEFT, TA_TOP ) );
	m_PlaceKeeper.SetBindings( IDC_STATIC_DESK, CRect( TA_LEFT, TA_TOP, TA_LEFT, TA_TOP  ) );

	m_pClient->SetClientNotifyWindow( m_hWnd );
	m_pClient->RequestWindowList();
	m_ClientView.ClearImage();
	/*CButton *chB_HookJava = (CButton *) (this->GetDlgItem(IDC_HOOK_JAVA));
	chB_HookJava->SetCheck(1);*/
	Log( L"Getting windows..." );

#ifdef WITHOUT_VNC
	pMenu.DeleteMenu(5, MF_BYPOSITION);
	//CMenu* RDP = pMenu.GetSubMenu(5);
	//RDP->DeleteMenu(9, MF_BYPOSITION);
	//RDP->DeleteMenu(9, MF_BYPOSITION);
#endif

	return TRUE;
}
Ejemplo n.º 2
0
void CSearch::OnNMRClickSearchlist(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
	// TODO: 在此添加控件通知处理程序代码

		//获取弹出菜单;
	CMenu* pMenu = new CMenu;
	pMenu->LoadMenuW(IDR_MENU1);

	CMenu* pSub = NULL;

	//判断搜索的是用户还是群
	if (m_bIsUid)
	{
		pSub = pMenu->GetSubMenu(0);
	}
	else
	{
		pSub = pMenu->GetSubMenu(2);
	}
	//获取鼠标位置;
	CPoint point;
	GetCursorPos(&point);

	//弹出;
	pSub->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this, NULL);

	*pResult = 0;
}
Ejemplo n.º 3
0
void CMonitorSessionDlg::OnNMRClickSessionList(NMHDR *pNMHDR, LRESULT *pResult)
{
	CPoint cp;
	GetCursorPos(&cp);
	m_list.ScreenToClient(&cp);
	
	CMenu menu;
	menu.LoadMenuW(IDR_MONITORLIST_MENU);

	int nItem=m_list.HitTest(cp);
	m_list.ClientToScreen(&cp);

	if(nItem>=0){
		m_list.SetHotItem(nItem);
		CMenu* pMenu=menu.GetSubMenu(0);
		pMenu->TrackPopupMenu(0,cp.x,cp.y,this);

	}
	else{
		CMenu* pMenu=menu.GetSubMenu(1);
		pMenu->TrackPopupMenu(0,cp.x,cp.y,this);
	}


	*pResult = 0;
}
void CMainWnd::MenuSwitch()
{
	m_wndMenu.DestroyMenu();
	switch (blMenu)
	{
	case TRUE:
		m_wndMenu.LoadMenuW(IDR_MENU);
		break;
	case FALSE:
		m_wndMenu.LoadMenuW(IDR_MENU_RUS);
		break;
	}

	// Меняем переменную на противоположную, так как мы выбрали другое меню
	blMenu = !blMenu;

	// Устанавливаем меню во фрейм
	SetMenu(&m_wndMenu);
}
Ejemplo n.º 5
0
//右键菜单
void CGuiderView::OnContextMenu(CWnd* pWnd, CPoint point)
{
	// TODO: 在此处添加消息处理程序代码
	//CMainFrame::m_bAutoMenuEnable=false;//不应该在这里,应该在它的构造里初始化

	////cstring   ss_test; 
	////cstring   ss_test1(""); 

	/////*ss_test.format("%d",point.x);   
	////ss_test1+=ss_test;
	////ss_test.format("%d",point.y);  
	////ss_test1+="+";
	////ss_test1+=ss_test;
	////afxmessagebox(ss_test1);  */

	//坐标转换
	CPoint p=point;
	this->ScreenToClient(&p);
	App_Veriable::RelativeContextMenuPos=p;//初始化菜单相对位置
	//转换后的坐标在p中
	if(App_Veriable::IsAddingRoute==false&&App_Veriable::ShortestRouteBeginID==0)//添加路径,寻找最短路径时候不再有菜单
	{
		CMenu popMenu;
		popMenu.LoadMenuW(IDR_MENU1);
		CMenu*pSubMenu=popMenu.GetSubMenu(0);

		if(sitelist.OnSite(p.x,p.y)==0&&routelist.OnRoute(p.x,p.y)==NULL)//点击空白
		{		
			pSubMenu->EnableMenuItem(ID_ADD_SITE,MF_ENABLED);
			pSubMenu->EnableMenuItem(ID_ADD_ROUTE,MF_GRAYED);
			pSubMenu->EnableMenuItem(ID_DELETE,MF_GRAYED);
			pSubMenu->EnableMenuItem(ID_SHORTEST_ROUTE,MF_GRAYED);
			pSubMenu->EnableMenuItem(ID_ATTRIBUTE,MF_GRAYED);
			//首先修改属性,再显示
		}
		else if(sitelist.OnSite(p.x,p.y)!=0)//点上
		{
			pSubMenu->EnableMenuItem(ID_ADD_SITE,MF_GRAYED);
			pSubMenu->EnableMenuItem(ID_ADD_ROUTE,MF_ENABLED);
			pSubMenu->EnableMenuItem(ID_DELETE,MF_ENABLED);
			pSubMenu->EnableMenuItem(ID_SHORTEST_ROUTE,MF_ENABLED);
			pSubMenu->EnableMenuItem(ID_ATTRIBUTE,MF_ENABLED);
		}
		else//线上
		{
			pSubMenu->EnableMenuItem(ID_ADD_SITE,MF_GRAYED);
			pSubMenu->EnableMenuItem(ID_ADD_ROUTE,MF_GRAYED);
			pSubMenu->EnableMenuItem(ID_DELETE,MF_ENABLED);
			pSubMenu->EnableMenuItem(ID_SHORTEST_ROUTE,MF_GRAYED);
			pSubMenu->EnableMenuItem(ID_ATTRIBUTE,MF_ENABLED);
		}
		pSubMenu->TrackPopupMenu (TPM_LEFTALIGN,point.x,point.y,pWnd);
	}
}
Ejemplo n.º 6
0
void CShareSessionDlg::OnNMRClickSessionList(NMHDR* pNMHDR, LRESULT* pResult){

	CPoint cp;
	GetCursorPos(&cp);
	m_list.ScreenToClient(&cp);
	
	CMenu menu;
	menu.LoadMenuW(IDR_SHARELIST_MENU);

	int nItem=m_list.HitTest(cp);
	m_list.ClientToScreen(&cp);

	if(nItem>=0){


		m_list.SetHotItem(nItem);

		CString name=m_list.GetItemText(nItem,1);
		CShareSession* pShareSession=this->GetShareSessionBySharerName(name);
		BOOL bState=pShareSession->bStateOn;
		BOOL bLock=pShareSession->bLockMode;

		CMenu* pMenu=menu.GetSubMenu(0);

		CString sMenuItemText;
		if(bState){
			sMenuItemText.LoadString(IDS_SHARELIST_MENUTEXT_STOPSESSION);
			pMenu->ModifyMenu(0,MF_BYPOSITION,IDM_ITEM_STOP,sMenuItemText/*_T("停止会话")*/);
		}
		else{
			sMenuItemText.LoadString(IDS_SHARELIST_MENUTEXT_STARTSESSION);
			pMenu->ModifyMenu(0,MF_BYPOSITION,IDM_ITEM_START,sMenuItemText/*_T("启动会话")*/);	
		}
		if(bLock){
			pMenu->CheckMenuItem(IDM_ITEM_LOCK,MF_CHECKED);
		}
		else {
			pMenu->CheckMenuItem(IDM_ITEM_LOCK,MF_UNCHECKED);
		}


		pMenu->TrackPopupMenu(0,cp.x,cp.y,this);

	}
	else{
		CMenu* pMenu=menu.GetSubMenu(1);
		pMenu->TrackPopupMenu(0,cp.x,cp.y,this);
	}
}
int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateScruct)
{
	if (CFrameWnd::OnCreate(lpCreateScruct) == -1)
		return -1;
	else {
		m_wndStatusBar.Create(this);

		// Загружаем меню из файлоы ресурса
		m_wndMenu.LoadMenuW(IDR_MENU);

		// Устанавливаем меню во фрейм
		SetMenu(&m_wndMenu);

		return 0;
	}
}
void UninstallTool::OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/)
{
	// TODO: 在此处添加消息处理程序代码
	CRect rect;
	m_UniListCtrl.GetClientRect(&rect);//可点击范围  
	CPoint p;

	//GetPhysicalCursorPos(&p);//鼠标坐标
	GetCursorPos(&p);
	rect.DeflateRect(0,23,0,0);
	m_UniListCtrl.ClientToScreen(rect);//基于屏幕坐标
	if (rect.PtInRect(p))//判断是否在客户区listctrl范围内
	{
		CMenu Menu;
		Menu.LoadMenuW(IDR_MENU2);//菜单资源
		CMenu *SubMenu=Menu.GetSubMenu(0);
		SubMenu->TrackPopupMenu(TPM_LEFTBUTTON|TPM_RIGHTBUTTON,p.x,p.y,this);
		//SubMenu->Detach();
		//Menu.DestroyMenu();//销毁
	}
}
Ejemplo n.º 9
0
LRESULT CRunDlg::OnContextMenu(UINT , WPARAM , LPARAM lp, BOOL &)
{
	cfg::config *c = cfg::config::instance();
	CMenu menu;
	menu.LoadMenuW(IDR_MENU_POPUP);
	CMenu mu = (HMENU)menu.GetSubMenu(0);

	POINT pt = {-1, -1};
	if (lp == 0xFFFFFFFF) // 菜单不是右键激活的而是按键激活的
	{
		hlp::track_mouse_event(TME_CANCEL|TME_LEAVE, m_hWnd);
		if (m_curr_prog_pos != pp_null)
		{
			lyt::icon_layout *il = dynamic_cast<lyt::icon_layout *>(m_lyt);
			if (il != NULL)
			{
				RECT rc = il->get_prog_rect(m_curr_prog_pos);
				m_menu_point.x = (rc.left + rc.right) / 2;
				m_menu_point.y = (rc.top + rc.bottom) / 2;
				pt = m_menu_point;
				ClientToScreen(&pt);
			}
		}
	}
	if (pt.x == -1)
	{
		::GetCursorPos(&pt);
		m_menu_point = pt;
		ScreenToClient(&m_menu_point);
	}

	if (c->gm.layout != cfg::ul_group)
	{
		mu.DeleteMenu(ID_INSERT_GROUP, MF_BYCOMMAND);
		mu.DeleteMenu(ID_EDIT_GROUP, MF_BYCOMMAND);
		mu.DeleteMenu(ID_DEL_GROUP, MF_BYCOMMAND);
	}
	if (c->gm.layout == cfg::ul_simple)
	{
		mu.DeleteMenu(ID_INSERT_PROG, MF_BYCOMMAND);
		mu.DeleteMenu(ID_EDIT_PROG, MF_BYCOMMAND);
		mu.DeleteMenu(ID_DEL_PROG, MF_BYCOMMAND);
	}

	if (m_lyt->get_insert_pos(m_menu_point) == pp_null)
	{
		mu.EnableMenuItem(ID_INSERT_PROG, MF_BYCOMMAND | MF_GRAYED);
//		mu.EnableMenuItem(ID_INSERT_GROUP, MF_BYCOMMAND | MF_GRAYED);
		mu.EnableMenuItem(ID_EDIT_GROUP, MF_BYCOMMAND | MF_GRAYED);
		mu.EnableMenuItem(ID_DEL_GROUP, MF_BYCOMMAND | MF_GRAYED);
	}
	if (m_lyt->get_prog_from_point(m_menu_point) == pp_null)
	{
		mu.EnableMenuItem(ID_EDIT_PROG, MF_BYCOMMAND | MF_GRAYED);
		mu.EnableMenuItem(ID_DEL_PROG, MF_BYCOMMAND | MF_GRAYED);
	}
	// 显示样式前面的对勾
	UINT lyt_id;
	switch (c->gm.layout)
	{
	case cfg::ul_simple: lyt_id = ID_CHLYT_SIMPLE; break;
	case cfg::ul_plain:  lyt_id = ID_CHLYT_PLAIN; break;
	default:             lyt_id = ID_CHLYT_GROUP; break;
	}
	mu.CheckMenuItem(lyt_id, MF_BYCOMMAND|MF_CHECKED);
	UINT style_id;
	switch (c->gm.style)
	{
	case cfg::ws_edge:  style_id = ID_CHSTYLE_EDGE; break;
	default:            style_id = ID_CHSTYLE_CENTER; break;
	}
	mu.CheckMenuItem(style_id, MF_BYCOMMAND|MF_CHECKED);

	// 删除多余的分隔线
	for (int i = mu.GetMenuItemCount() - 1; i > 0; i--)
	{
		if (mu.GetMenuStringLen(i,   MF_BYPOSITION) == 0 &&
			mu.GetMenuStringLen(i-1, MF_BYPOSITION) == 0)
		{
			mu.DeleteMenu(i, MF_BYPOSITION);
		}
	}

	KillTimer(IDT_AUTO_FOLD); // 菜单消失前不能让窗口自动隐藏
	mu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, m_hWnd);
	change_op_state(os_hover);
	return TRUE;
}