Ejemplo n.º 1
0
void CBaseView::OnMouseMove(UINT nFlags, CPoint point) 
{
	CWnd::OnMouseMove(nFlags, point);

	CStatusBar* pStatusBar = DYNAMIC_DOWNCAST(CStatusBar, 
		AfxGetMainWnd()->GetDlgItem(AFX_IDW_STATUS_BAR));
	ASSERT(pStatusBar != NULL);

	Point2d pnt((float)point.x, (float)point.y);
	pnt *= m_graph->xf.displayToModel();

	CString str;
	int index = pStatusBar->CommandToIndex(ID_INDICATOR_X);
	if (index >= 0)
	{
		str.Format(_T("X: %.2lf"), pnt.x);
		pStatusBar->SetPaneText(index, str);
	}

	index = pStatusBar->CommandToIndex(ID_INDICATOR_Y);
	if (index >= 0)
	{
		str.Format(_T("Y: %.2lf"), pnt.y);
		pStatusBar->SetPaneText(index, str);
	}
}
Ejemplo n.º 2
0
void CMyView::OnMouseMove(UINT nFlags, CPoint point)
{
    // TODO: Add your message handler code here and/or call default
    CClientDC dc(this);
    if (m_isLine)
    {
        if (m_nStep!=0)
        {
            dc.SetROP2(R2_NOTXORPEN); //设置绘图模式
            if (m_endx!=0)      //如果不是第一次画线,则擦除上一线条
            {
                dc.MoveTo(m_startx,m_starty);
                dc.LineTo(m_endx,m_endy);
            }
            //更新终点坐标
            m_endx=point.x;
            m_endy=point.y;
            //画出新的线段
            dc.MoveTo(m_startx,m_starty);
            dc.LineTo(m_endx,m_endy);
        }
    }
    CString str;
    CStatusBar *pStatusbar;
    pStatusbar=(CStatusBar*)AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR);
    if (pStatusbar)
    {
        str.Format("x =%4d , y =%4d",point.x,point.y);   //%后面的数字设置等号与其后数字的间隔大小
        pStatusbar->SetPaneText(1,str);     //设置状态栏第二窗格显示当前坐标
    }
    CView::OnMouseMove(nFlags, point);
}
Ejemplo n.º 3
0
void CProcessManager::CreatStatusBar(void)
{
	RECT	rect;
	GetClientRect(&rect);

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		sizeof(indicators)/sizeof(UINT)))
	{
		return ;      
	}

	m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_STRETCH, NULL);
	
	RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); //显示状态栏
	

	CRect rc;
	rc.top=rect.bottom-22;
	rc.left=0;
	rc.right=rect.right;
	rc.bottom=rect.bottom;

	m_wndStatusBar.MoveWindow(rc);           

	CString strStatusMsg;
	strStatusMsg.Format(L"进程:%d , 隐藏进程:%d , 应用层不可访问进程:%d",g_ProcessCount,g_HideProcessCount,1);
	m_wndStatusBar.SetPaneText(0,strStatusMsg);  
}
Ejemplo n.º 4
0
void CStatusCmdUI::SetText( LPCTSTR lpszText )
/******************************************/
{
    CStatusBar *pStatusBar = (CStatusBar *)m_pOther;
    ASSERT( pStatusBar != NULL );
    ASSERT( pStatusBar->IsKindOf( RUNTIME_CLASS( CStatusBar ) ) );
    pStatusBar->SetPaneText( m_nIndex, lpszText );
}
Ejemplo n.º 5
0
CMDIDoc::~CMDIDoc()
{
	CString Idle = LPCTSTR(AFX_IDS_IDLEMESSAGE);
	//Idle = LPCTSTR(L"lawlawlwawl");
	CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
	CStatusBar* pStatus = &pFrame->m_wndStatusBar;
	pStatus->SetPaneText(0, Idle );
}
Ejemplo n.º 6
0
void CProcessManager::OnProcessRefresh()
{
	ULONG_PTR  ulControlCode =FORCE_ENUM_PROCESS;
	SendIoControlCode(ulControlCode);

	CString strStatusMsg;
	strStatusMsg.Format(L"进程:%d , 隐藏进程:%d , 应用层不可访问进程:%d",g_ProcessCount,g_HideProcessCount,g_OpenProcessFailedCount);
	m_wndStatusBar.SetPaneText(0,strStatusMsg);  
}
Ejemplo n.º 7
0
void CMDIView::OnMouseMove(UINT nFlags, CPoint point)
{
	
  // Define a Device Context object for the view
  CClientDC aDC(this);                                                 // DC is for this view

  // Verify the left button is down and mouse messages captured
  if((nFlags & MK_LBUTTON) && (this == GetCapture()))                  
  {
    m_SecondPoint = point;                                             // Save the current cursor position
    if(m_pTempElement)
    {
      // An element was created previously
      if(ElementType::CURVE == GetDocument()->GetElementType())        // A curve?
      {  // We are drawing a curve so add a segment to the existing curve
         std::static_pointer_cast<CCurve>(m_pTempElement)->AddSegment(m_SecondPoint);
         m_pTempElement->Draw(&aDC);                                   // Now draw it
         return;                                                       // We are done
      }
      else
      {
        // If we get to here it's not a curve so
        // redraw the old element so it disappears from the view
        aDC.SetROP2(R2_NOTXORPEN);                                     // Set the drawing mode
        m_pTempElement->Draw(&aDC);                                    // Redraw the old element to erase it
      }
    }

    // Create a temporary element of the type and color that
    // is recorded in the document object, and draw it
    m_pTempElement.reset(CreateElement());                             // Create a new element
    m_pTempElement->Draw(&aDC);                                        // Draw the element

  }




    { 
	  CString s;
	  //s.Format(L"X=%d Y=%d", point.x, point.y);
	  s.Format(L"X=%d Y=%d", point.x, point.y);
	  CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
	  CMDIChildWnd* pActiveChild = pFrame->MDIGetActive();		  
	  CStatusBar* pStatus = &pFrame->m_wndStatusBar;

	  //if (pActiveChild && pActiveChild->GetActiveDocument())
	 
	     // one or more documents open
		  pStatus->SetPaneText(0, s);
	  }
	 
 
	 
}
Ejemplo n.º 8
0
BOOL CProgressBar::Resize() 
{
	if (!IsWindow(GetSafeHwnd()))
		return FALSE;

	CStatusBar *pStatusBar = GetStatusBar();
	if (!pStatusBar)
		return FALSE;

	// Redraw the window text
	if (IsWindowVisible())
	{
		pStatusBar->SetPaneText(m_nPane, m_strMessage);
		pStatusBar->UpdateWindow();
	}

	// Calculate how much space the text takes up
	CClientDC dc(pStatusBar);
	CFont *pOldFont = dc.SelectObject(pStatusBar->GetFont());
	CSize size = dc.GetTextExtent(m_strMessage);		// Length of text
	int margin = dc.GetTextExtent(_T(" ")).cx * 2;		// Text margin
	dc.SelectObject(pOldFont);

	// Now calculate the rectangle in which we will draw the progress bar
	CRect rc;
	pStatusBar->GetItemRect(m_nPane, rc);

	// Position left of progress bar after text and right of progress bar
	// to requested percentage of status bar pane
	if (!m_strMessage.IsEmpty())
	    rc.left += (size.cx + 2*margin);
	rc.right -= (rc.right - rc.left) * (100 - m_nSize) / 100;

	if (rc.right < rc.left) rc.right = rc.left;
	
	// Leave a litle vertical margin (10%) between the top and bottom of the bar
	int Height = rc.bottom - rc.top;
	rc.bottom -= Height/10;
	rc.top	  += Height/10;

	// If the window size has changed, resize the window
	if (rc != m_Rect)
	{
		MoveWindow(&rc);
		m_Rect = rc;
	}

	return TRUE;
}
void CScanLineZBufferView::OnTimer(UINT_PTR nIDEvent)
{
	// 状态指示器,更新模型的顶点数,面数
	// 如果没有载入模型
	char info[256];
	CString infoCString;
	CStatusBar* barPtr = (CStatusBar*)(AfxGetMainWnd()->GetDescendantWindow(AFX_IDW_STATUS_BAR));
	if (barPtr) {
		if (GetDocument()->m_mesh.n_vertices() <= 0) {
			sprintf_s(info, "No mesh model data!");
		}
		else {
			sprintf_s(info, "vertices: %d  faces: %d", GetDocument()->m_mesh.n_vertices(), GetDocument()->m_mesh.n_faces());
		}
		infoCString = info;
		barPtr->SetPaneText(0, (LPCTSTR)infoCString);
	}
	CView::OnTimer(nIDEvent);
}
Ejemplo n.º 10
0
void CProgressBar::Clear()
{
	if (!IsWindow(GetSafeHwnd()))
		return;

	// Hide the window. This is necessary so that a cleared
	// window is not redrawn if "Resize" is called
	ModifyStyle(WS_VISIBLE, 0);

	CString str;
	if (m_nPane == 0)
		str.LoadString(AFX_IDS_IDLEMESSAGE);   // Get the IDLE_MESSAGE
      else
		str = m_strPrevText;                   // Restore previous text

	// Place the IDLE_MESSAGE in the status bar 
	CStatusBar *pStatusBar = GetStatusBar();
	if (pStatusBar)
	{
		pStatusBar->SetPaneText(m_nPane, str);
		pStatusBar->UpdateWindow();
	}
}
Ejemplo n.º 11
0
void CServerList::OnServerRefresh()
{
	CCacheList * pCache = CCacheList::getCacheList();
	if (! pCache )
		return;

	CWaitCursor waitCursor;	

	CStatusBar * pStatusBar = (CStatusBar *)GetParentFrame()->GetDlgItem( AFX_IDW_STATUS_BAR );
	ASSERT( pStatusBar );

	pStatusBar->SetPaneText( 0, _T("Getting game list...") );

	//ASSERT( pCache );

	m_Servers.release();
	m_Programs.release();

	GetListCtrl().SetImageList( &pCache->m_ProgramIcons, LVSIL_SMALL );

	MetaClient & client = CGCQLApp::sm_MetaClient;
	dword clientFlags = client.profile().flags;
	if ( client.getServers( "", m_nGameIdFilter, m_nServerTypeFilter, m_Servers ) )
	{
		m_Programs.allocate( m_Servers.size() );
		for(int i=0;i<m_Programs.size();++i)
		{
			MetaClient::Server & server = m_Servers[i];
			m_Programs[i] = pCache->findProgram( server.gameId, server.type );
		}

		CListCtrl & list = GetListCtrl();

		list.DeleteAllItems();
		for(int i=0;i<m_Servers.size();++i)
		{
			MetaClient::Server & server = m_Servers[i];
			CCacheList::Program * pProgram = m_Programs[ i ];
			if (! pProgram || !pProgram->m_bCanUse )
				continue;		// unknown or unusable program, skip this server..

			CString sClients;
			if ( clientFlags & MetaClient::ADMINISTRATOR )
				sClients.Format("%d / %d", server.clients, server.maxClients);
			else
				sClients = MetaClient::populationText( server.clients, server.maxClients );

			int item = list.InsertItem( i, CString(server.name), pProgram->m_nIndex );
			list.SetItemText(item, 1, CString(server.shortDescription) );
			list.SetItemText(item, 2, sClients );
			list.SetItemText(item, 3, m_Programs[i]->m_sDescription );
			list.SetItemData( item, i );
		}

		if ( m_Servers.size() > 0 )
			sortServers();

		CString sActiveServers;
		sActiveServers.Format(_T("%d Active Servers"), list.GetItemCount() );
		pStatusBar->SetPaneText( 0, sActiveServers );
	}
	else
		MessageBox( _T("Failed to get game list from server; please try again later!") );
}
Ejemplo n.º 12
0
void CDialogProcSelect::OnAttachButton( )
{
    int SelectedIndex = m_ProcessList.GetSelectionMark( );
    if (SelectedIndex != -1)
    {
        HANDLE ProcessHandle;
        DWORD SelectedProcessId;
        TCHAR SelectedProcessIdText[64];

        m_ProcessList.GetItemText( SelectedIndex, COLUMN_PROCESSID, SelectedProcessIdText, sizeof( SelectedProcessIdText ) );
        SelectedProcessId = _tcstoul( SelectedProcessIdText, NULL, 10 );

        auto FoundProcessInfo = std::find_if( m_ProcessInfos.begin( ), m_ProcessInfos.end( ),
                                             [SelectedProcessId] ( const ProcessInfoStack& proc ) -> bool { return proc.dwProcessId == SelectedProcessId; } );

        if (FoundProcessInfo != m_ProcessInfos.end( ))
        {
            ProcessHandle = ReClassOpenProcess( PROCESS_ALL_ACCESS, FALSE, FoundProcessInfo->dwProcessId );
            if (ProcessHandle == NULL || GetLastError( ) != ERROR_SUCCESS)
            {
                CString MessageText;
                MessageText.Format( _T( "Failed to attach to process \"%s\"!" ), FoundProcessInfo->strProcessName.GetString( ) );
                MessageBox( MessageText, g_ReClassApp.m_pszAppName, MB_OK | MB_ICONERROR );
            }
            else
            {
                if (g_hProcess != NULL) // Stop leaking handles!
                    CloseHandle( g_hProcess ); 

                g_hProcess = ProcessHandle;
                g_ProcessID = FoundProcessInfo->dwProcessId;
                g_ProcessName = FoundProcessInfo->strProcessName;

                UpdateMemoryMap( );

                if (g_bSymbolResolution && m_LoadAllSymbols.GetCheck( ) == BST_CHECKED)
                {
                    OnClose( );
                
                    MSG Msg;
                    CStatusBar* StatusBar = g_ReClassApp.GetStatusBar( );

                    CProgressBar ProgressBar( _T( "Progress" ), 100, 100, TRUE, 0, StatusBar );
                    ProgressBar.SetStep( 1 );
                    ProgressBar.SetText( _T( "Symbols loading: " ) );

                    for (size_t i = 0; i < g_MemMapModules.size( ); i++)
                    {
                        TCHAR ProgressText[256];
                        MemMapInfo *CurrentModule = &g_MemMapModules[i];

                        ProgressBar.SetRange32( 0, (int)g_MemMapModules.size( ) );

                        _stprintf_s( ProgressText, _T( "[%d/%d] %s" ), (UINT)i + 1, (UINT)g_MemMapModules.size( ), CurrentModule->Name.GetString( ) );
                        StatusBar->SetPaneText( 1, ProgressText );

                        //MemMapInfo* pCurrentModule = new MemMapInfo( CurrentModule );
                        //Utils::NtCreateThread( LoadModuleSymbolsThread, pCurrentModule, 0 );

                        if (!g_ReClassApp.m_pSymbolLoader->LoadSymbolsForModule( CurrentModule->Path, CurrentModule->Start, CurrentModule->Size ))
                        {
                            PrintOut( _T( "Failed to load symbols for %s" ), CurrentModule->Name.GetString( ) );
                        }

                        ProgressBar.StepIt( );

                        // Peek and pump through messages to stop reclass from hanging
                        while (::PeekMessage( &Msg, NULL, 0, 0, PM_NOREMOVE ))
                        {
                            if (!AfxGetApp( )->PumpMessage( ))
                                ::PostQuitMessage( 0 );
                        }
                    }

                    StatusBar->SetPaneText( 1, _T( "" ) );

                    return;
                }

                OnClose( );
            }
        }
    }
}
Ejemplo n.º 13
0
BOOL CCOXRayDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;

	// TODO:  在此添加您专用的创建代码
	USES_CONVERSION;
	char *filename = W2A(lpszPathName);

	if (m_pHWorkImage == NULL)
	{
		m_pHWorkImage = new HImage();
	}

	if (m_pOriginImage == NULL)
	{
		m_pOriginImage = new HImage();
	}

	// 清空Undo
	ClearUndoDraw();
	ClearUndoImage();
	m_UndoType.RemoveAll();

	m_Stopwatch.Start();
	HImage Image;
	try
	{
		*m_pHWorkImage = HImage::ReadImage(filename);
	}
	catch (HException &except)
	{
		CString strErrorMsg;

		strErrorMsg.Format(_T("读图像失败,请确认是否为图像格式!"));

		AfxMessageBox(strErrorMsg);
		return FALSE;
	}
	
	m_Stopwatch.Stop();

	// 转换为8位3通道
// 	if (GetImageBits(*m_pHWorkImage) == 16)
// 	{
// 		*m_pHWorkImage = ConvertImage(*m_pHWorkImage,IPL_DEPTH_8U,3);
// 	}

	// 备份原始图像
	*m_pOriginImage = *m_pHWorkImage;

	m_dbZoomFactor = 1;
	m_nChanels = m_pHWorkImage->CountChannels();

	// 转换为灰度图像
// 	if (m_nChanels > 1)
// 	{
// 		*m_pHWorkImage = m_pHWorkImage->Rgb1ToGray();
// 		m_nChanels = 1;
// 	}

	CString strTime,strInfo,strExt,strZoom;
	strExt = CUtils::GetFileExt(lpszPathName);
	strExt.MakeUpper();

	int bits = GetImageBits(m_pHWorkImage->GetImageType()[0].S());
	bits *= m_nChanels;

	strTime.Format(_T("Time: %.2f s"),m_Stopwatch.GetSecond());
	strInfo.Format(_T("%s %dx%dx%d"),strExt,m_pHWorkImage->Width(),m_pHWorkImage->Height(),bits);
	strZoom.Format(_T("%.0f%%"),m_dbZoomFactor * 100);

	CStatusBar *pStatusBar = ((CMainFrame *)AfxGetMainWnd())->GetStatusBar();

	int nIndex = pStatusBar->CommandToIndex(ID_INDICATOR_TIME);
	pStatusBar->SetPaneText(nIndex,strTime);

	nIndex = pStatusBar->CommandToIndex(ID_INDICATOR_IMG_INFO);
	pStatusBar->SetPaneText(nIndex,strInfo);

	nIndex = pStatusBar->CommandToIndex(ID_INDICATOR_ZOOM);
	pStatusBar->SetPaneText(nIndex,strZoom);

	//UpdateAllViews(NULL,WM_USER_NEWIMAGE);
	OnBtnFitWindow();

	return TRUE;
}