void CMainFrame::OnViewCompactview() { // TODO: Add your command handler code here CRect clientrect; CRect windowrect; CRect toolbarrect; CRect statusbarrect; GetWindowRect(&windowrect); GetClientRect(&clientrect); m_wndToolBar.GetWindowRect(&toolbarrect); int borderHeight = GetSystemMetrics(SM_CYBORDER); //Dock Toolbar DockControlBar(&m_wndToolBar); //Hide Menu if ( hMenu != NULL ) ::SetMenu( m_hWnd, hMenu ); //Hide Status Bar CStatusBar* pStatus = (CStatusBar*) AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR); pStatus->ShowWindow(SW_HIDE); int compactcx = windowrect.Width(); int compactcy = windowrect.Height() - clientrect.Height() + toolbarrect.Height() - borderHeight - borderHeight; cProgramOpts.m_iViewType = VIEW_COMPACT; SetWindowPos( &wndTop, windowrect.left, windowrect.top, compactcx, compactcy, SWP_SHOWWINDOW); }
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); } }
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); }
void CStatusCmdUI::SetText( LPCTSTR lpszText ) /******************************************/ { CStatusBar *pStatusBar = (CStatusBar *)m_pOther; ASSERT( pStatusBar != NULL ); ASSERT( pStatusBar->IsKindOf( RUNTIME_CLASS( CStatusBar ) ) ); pStatusBar->SetPaneText( m_nIndex, lpszText ); }
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 ); }
void CMainFrame::ResizeToMovie(RECT movierect) { // TODO: Add your command handler code here CRect clientrect; CRect windowrect; CRect toolbarrect; CRect statusbarrect; GetWindowRect( &windowrect); GetClientRect( &clientrect); m_wndToolBar.GetWindowRect(&toolbarrect); CStatusBar* pStatus = (CStatusBar*) AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR); pStatus->GetWindowRect(&statusbarrect); int borderHeight = GetSystemMetrics(SM_CYBORDER); int borderWidth = GetSystemMetrics(SM_CXBORDER); int captionHeight = GetSystemMetrics(SM_CYCAPTION); //Dock Toolbar // @FIXME[Carlo Lanzotti]: No need to call this unless the tool bar are set to be dockable. //DockControlBar(&m_wndToolBar); //Menu Height int menuY = GetSystemMetrics(SM_CYMENU); CWnd* mainWindow = AfxGetMainWnd( ); AdjustWindowRectEx(&movierect, GetWindowLong(mainWindow->m_hWnd, GWL_STYLE), TRUE, GetWindowLong(mainWindow->m_hWnd, GWL_EXSTYLE)); int compactcx = movierect.right-movierect.left + 1 + 4; int compactcy = movierect.bottom-movierect.top + 1 + toolbarrect.Height() +statusbarrect.Height() + 4; //compactcx += 2; //compactcy += 2; //if (compactcx > 600) compactcx=600; //if (compactcy > 480) compactcy=480; if (compactcx > maxxScreen - windowrect.left) { windowrect.left = maxxScreen - compactcx; } if (compactcy > maxyScreen - windowrect.top) { windowrect.top = maxyScreen - compactcy - 20; //20 to compensate for taskbar height } if (windowrect.left<=0) { windowrect.left = 1; } if (windowrect.top<=0) { windowrect.top = 1; } SetWindowPos( &wndTop, windowrect.left, windowrect.top, compactcx, compactcy, SWP_SHOWWINDOW); }
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); } }
void CStatusCmdUI::SetCheck( int nCheck ) /***************************************/ { CStatusBar *pStatusBar = (CStatusBar *)m_pOther; ASSERT( pStatusBar != NULL ); ASSERT( pStatusBar->IsKindOf( RUNTIME_CLASS( CStatusBar ) ) ); UINT nStyle = pStatusBar->GetPaneStyle( m_nIndex ); if( nCheck == 0 ) { nStyle &= ~SBPS_POPOUT; } else { nStyle |= SBPS_POPOUT; } pStatusBar->SetPaneStyle( m_nIndex, nStyle ); }
void CStatusCmdUI::Enable( BOOL bOn ) /***********************************/ { CStatusBar *pStatusBar = (CStatusBar *)m_pOther; ASSERT( pStatusBar != NULL ); ASSERT( pStatusBar->IsKindOf( RUNTIME_CLASS( CStatusBar ) ) ); UINT nStyle = pStatusBar->GetPaneStyle( m_nIndex ); if( bOn ) { nStyle &= ~SBPS_DISABLED; } else { nStyle |= SBPS_DISABLED; } pStatusBar->SetPaneStyle( m_nIndex, nStyle ); }
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; }
// Create the CProgressCtrl as a child of the status bar positioned // over the first pane, extending "nSize" percentage across pane. // Sets the range to be 0 to MaxValue, with a step of 1. BOOL CProgressBar::Create(LPCTSTR strMessage, int nSize /*=100*/, int MaxValue /*=100*/, BOOL bSmooth /*=FALSE*/, int nPane /*=0*/) { BOOL bSuccess = FALSE; CStatusBar *pStatusBar = GetStatusBar(); if (!pStatusBar) return FALSE; DWORD dwStyle = WS_CHILD|WS_VISIBLE; #ifdef PBS_SMOOTH if (bSmooth) dwStyle |= PBS_SMOOTH; #endif // Until m_nPane is initialized, Resize() must not be called. But it can be called (which // happens in multi-threaded programs) in CProgressBar::OnEraseBkgnd after the control is // created in CProgressBar::Create. m_strMessage = strMessage; m_nSize = nSize; m_nPane = nPane; m_strPrevText = pStatusBar->GetPaneText(m_nPane); // Get CRect coordinates for requested status bar pane CRect PaneRect; pStatusBar->GetItemRect(nPane, &PaneRect); // Create the progress bar bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1); ASSERT(bSuccess); if (!bSuccess) return FALSE; // Set range and step SetRange(0, MaxValue); SetStep(1); m_strMessage = strMessage; m_nSize = nSize; m_nPane = nPane; m_strPrevText = pStatusBar->GetPaneText(m_nPane); // Resize the control to its desired width Resize(); return TRUE; }
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); }
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); }
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); }
// Create the CProgressCtrl as a child of the status bar positioned // over the first pane, extending "nSize" percentage across pane. // Sets the range to be 0 to MaxValue, with a step of 1. BOOL CProgressBar::Create(LPCTSTR strMessage, int nSize /*=100*/, int MaxValue /*=100*/, BOOL bSmooth /*=FALSE*/, int nPane /*=0*/) { BOOL bSuccess = FALSE; CStatusBar *pStatusBar = GetStatusBar(); if (!pStatusBar) return FALSE; DWORD dwStyle = WS_CHILD|WS_VISIBLE; #ifdef PBS_SMOOTH if (bSmooth) dwStyle |= PBS_SMOOTH; #endif // Get CRect coordinates for requested status bar pane CRect PaneRect; pStatusBar->GetItemRect(nPane, &PaneRect); // Create the progress bar bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1); ASSERT(bSuccess); if (!bSuccess) return FALSE; // Set range and step SetRange(0, MaxValue); SetStep(1); m_strMessage = strMessage; m_nSize = nSize; m_nPane = nPane; m_strPrevText = pStatusBar->GetPaneText(m_nPane); // Resize the control to its desired width Resize(); return TRUE; }
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(); } }
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; } }
// Window Procedure LRESULT CWinMain::WndProc(HWND window, UINT msg, WPARAM wp, LPARAM lp) { static CMainToolBar main_tool_bar; static CSearchToolBar search_tool_bar; static CMainListView list_view; static CStatusBar status_bar; static CExtractData extract; static COption option; static CVersionInfo version; static CLastDir last_dir; static TCHAR readme_file_name[MAX_PATH]; static TCHAR history_file_name[MAX_PATH]; static TCHAR state_file_name[MAX_PATH]; INITCOMMONCONTROLSEX ic; switch (msg) { case WM_CREATE: { // Allow D&D (Drag & Drop) DragAcceptFiles(window, TRUE); option.Init(search_tool_bar, list_view); // Initialization of the common installation configuration ic.dwSize = sizeof(INITCOMMONCONTROLSEX); ic.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&ic); // Create main toolbar main_tool_bar.Create(window); search_tool_bar.Create(window); // Create list view list_view.Create(window, option.GetOpt()); // Create status bar status_bar.Create(window, option.GetOpt(), list_view); // Get full path TCHAR ModulePath[MAX_PATH]; GetModuleFileName(nullptr, ModulePath, MAX_PATH); PathRemoveFileSpec(ModulePath); // Retrieves full path of the location of Readme.txt lstrcpy(readme_file_name, ModulePath); PathAppend(readme_file_name, _T("Readme.txt")); // Retrieves full path of the location of History.txt lstrcpy(history_file_name, ModulePath); PathAppend(history_file_name, _T("History.txt")); // Retrieves full path of the location of State.txt lstrcpy(state_file_name, ModulePath); PathAppend(state_file_name, _T("State.txt")); extract.Init(window, option.GetOpt(), list_view); break; } case WM_DROPFILES: extract.OpenDrop(wp); main_tool_bar.AddOpenHistory(extract.GetArcList()); status_bar.SetCount(); break; case WM_COMMAND: switch (LOWORD(wp)) { case IDM_OPEN: // Open a file to load extract.Open(last_dir.GetOpen()); main_tool_bar.AddOpenHistory(extract.GetArcList()); status_bar.SetCount(); last_dir.SaveIni(); break; case IDM_CLOSE: // Close the opened file extract.Close(); status_bar.SetCount(); break; // Open a file from history case ID_TOOLBAR_OPEN_HISTORY: case ID_TOOLBAR_OPEN_HISTORY+1: case ID_TOOLBAR_OPEN_HISTORY+2: case ID_TOOLBAR_OPEN_HISTORY+3: case ID_TOOLBAR_OPEN_HISTORY+4: case ID_TOOLBAR_OPEN_HISTORY+5: case ID_TOOLBAR_OPEN_HISTORY+6: case ID_TOOLBAR_OPEN_HISTORY+7: case ID_TOOLBAR_OPEN_HISTORY+8: case ID_TOOLBAR_OPEN_HISTORY+9: extract.OpenHistory(main_tool_bar.GetHistory()[LOWORD(wp)-ID_TOOLBAR_OPEN_HISTORY]); main_tool_bar.AddOpenHistory(extract.GetArcList()); status_bar.SetCount(); break; // Search button configuration file case IDM_AHX: case IDM_BMP: case IDM_JPG: case IDM_MID: case IDM_MPG: case IDM_OGG: case IDM_PNG: case IDM_WAV: case IDM_WMV: search_tool_bar.SetSearch(LOWORD(wp)); break; // Quick settings case IDM_QUICKSET_STD_SEARCHOGG: case IDM_QUICKSET_EXTRACT_CREATEFOLDER: case IDM_QUICKSET_EXTRACT_FIXOGG: case IDM_QUICKSET_EXTRACT_EASYDECRYPT: case IDM_QUICKSET_EXTRACT_DSTPNG: case IDM_QUICKSET_EXTRACT_ALPHABLEND: case IDM_QUICKSET_SUSIE_USE: case IDM_QUICKSET_SUSIE_FIRST: SetQuickMenuItem(LOWORD(wp)); break; case IDM_EXIT: // Exit SendMessage(window, WM_CLOSE, 0, 0); break; case IDM_EXTRACT: // Extract the selected range if (list_view.GetCountSel() > 0) { extract.SaveSel(last_dir.GetSave(), true); } last_dir.SaveIni(); break; case IDM_EXTRACTALL: // Extract all if( list_view.GetCount() > 0 ) { extract.SaveAll(last_dir.GetSave(), true); } last_dir.SaveIni(); break; case IDM_EXTRACT_NOTCONVERT: // Extracts the selection without converting it if (list_view.GetCountSel() > 0) { extract.SaveSel(last_dir.GetSave(), false); } last_dir.SaveIni(); break; case IDM_EXTRACTALL_NOTCONVERT: // Extracts all without conversion if (list_view.GetCount() > 0) { extract.SaveAll(last_dir.GetSave(), false); } last_dir.SaveIni(); break; case IDM_SELECTALL: // Select all list_view.SetItemSelAll(LVIS_SELECTED); break; case IDM_OPTION: // Options option.DoModal(window); break; case IDM_README: // Open Readme.txt ShellExecute(nullptr, _T("open"), readme_file_name, nullptr, nullptr, SW_SHOWNORMAL); break; case IDM_HISTORY: // Open History.txt ShellExecute(nullptr, _T("open"), history_file_name, nullptr, nullptr, SW_SHOWNORMAL); break; case IDM_STATE: // Open State.txt ShellExecute(nullptr, _T("open"), state_file_name, nullptr, nullptr, SW_SHOWNORMAL); break; case IDM_VERSION: // Version info version.DoModal(window); break; } break; // Right-click Menu case WM_CONTEXTMENU: CreateMenu(lp); break; case WM_MOUSEWHEEL: { POINT pos; GetCursorPos(&pos); HWND point_window = WindowFromPoint(pos); if (point_window == list_view.GetHandle()) SendMessage(point_window, WM_MOUSEWHEEL, wp, lp); break; } case WM_NOTIFY: { // Toolbar if (wp == ID_TOOLBAR) { LPNMTOOLBAR nm = reinterpret_cast<LPNMTOOLBAR>(lp); switch (nm->hdr.code) { // File History case TBN_DROPDOWN: main_tool_bar.CreateMenuHistory(nm->iItem); break; } } // List view if (wp == idsMainList) { LPNMLISTVIEW nm = reinterpret_cast<LPNMLISTVIEW>(lp); switch (nm->hdr.code) { // Sort case LVN_COLUMNCLICK: list_view.Sort(nm->iSubItem); break; // Show Tooltips case LVN_GETINFOTIP: list_view.ShowTip(reinterpret_cast<LPNMLVGETINFOTIP>(lp)); break; // View case LVN_GETDISPINFO: list_view.Show(reinterpret_cast<NMLVDISPINFO*>(lp)); break; // D&D (Drag & Drop) case LVN_BEGINDRAG: { //extract.SaveDrop(); LRESULT result; list_view.OnBeginDrag(reinterpret_cast<NMHDR*>(lp), &result); break; } // Playback / Viewing by double-clicking case NM_DBLCLK: if (list_view.GetCountSel() > 0) { extract.DecodeTmp(); extract.OpenRelate(); } break; } } break; } case WM_SIZE: main_tool_bar.SetWindowPos(0, 0, 100, 26); search_tool_bar.SetWindowPos(100, 0, LOWORD(lp), 26); list_view.SetWindowPos(0, 28, LOWORD(lp), HIWORD(lp) - 48); status_bar.SetWindowPos(LOWORD(lp)); break; case WM_CLOSE: // Save SaveIni(); list_view.SaveIni(); // Clean up extract.Close(); DestroyWindow(window); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(window, msg, wp, lp); } return 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; }
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( ); } } } }
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!") ); }