void SizePerfmonComponents (void) { RECT rectClient ; int xWidth, yHeight ; int yToolbarHeight ; int yStatusHeight ; int yViewHeight ; GetClientRect (hWndMain, &rectClient) ; xWidth = rectClient.right - rectClient.left ; yHeight = rectClient.bottom - rectClient.top ; if (Options.bToolbar) { SendMessage (hWndToolbar, WM_SIZE, 0, 0L) ; } yToolbarHeight = Options.bToolbar ? (WindowHeight (hWndToolbar) - 1) : 0 ; yStatusHeight = Options.bStatusbar ? StatusHeight (hWndStatus) : 0 ; if (Options.bStatusbar) { if (yToolbarHeight + yStatusHeight > yHeight) { // too small to display both toolbar and status bar // just display part of the status bar yStatusHeight = yHeight - yToolbarHeight ; } MoveWindow (hWndStatus, 0, yHeight - yStatusHeight, xWidth, yStatusHeight, TRUE) ; //WindowInvalidate (hWndStatus) ; } //WindowInvalidate (hWndMain) ; WindowShow (hWndStatus, Options.bStatusbar) ; WindowShow (hWndToolbar, Options.bToolbar) ; yViewHeight = yHeight - yStatusHeight - yToolbarHeight ; MoveWindow (hWndGraph, 0, yToolbarHeight, xWidth, yViewHeight, TRUE) ; MoveWindow (hWndAlert, 0, yToolbarHeight, xWidth, yViewHeight, TRUE) ; MoveWindow (hWndLog, 0, yToolbarHeight, xWidth, yViewHeight, TRUE) ; MoveWindow (hWndReport, 0, yToolbarHeight, xWidth, yViewHeight, TRUE) ; } // SizePerfmonComponents
void static OnCreate (HWND hWnd) /* Effect: Perform all actions needed when the main window is created. In particular, create the three data windows, and show one of them. To Do: Check for proper creation. If not possible, we will need to abort creation of the program. Called By: MainWndProc only, in response to a WM_CREATE message. */ { // OnCreate hWndGraph = CreateGraphWindow (hWnd) ; #ifdef ADVANCED_PERFMON hWndLog = CreateLogWindow (hWnd) ; hWndAlert = CreateAlertWindow (hWnd) ; hWndReport = CreateReportWindow (hWnd) ; #endif hWndStatus = CreatePMStatusWindow (hWnd) ; CreateToolbarWnd (hWnd) ; MinimumSize += WindowHeight (hWndToolbar) ; Options.bMenubar = TRUE ; Options.bToolbar = TRUE ; Options.bStatusbar = TRUE; Options.bAlwaysOnTop = FALSE ; // initialize to chart view - HWC iPerfmonView = IDM_VIEWCHART; ShowWindow (PerfmonViewWindow (), SW_SHOWNORMAL) ; } // OnCreate
void FlagWatcher::CreateChildren(HWND hWnd){ m_flagWatcherDlg.Create(hWnd); SetSize(m_flagWatcherDlg.WindowWidth()+(WindowWidth()-ClientWidth()), m_flagWatcherDlg.WindowHeight()+(WindowHeight()-ClientHeight())); }
int SetWindowXY(HWND hWnd, int x, int y){ return MoveWindow(hWnd, x, y, WindowWidth(hWnd), WindowHeight(hWnd), true); }
int WindowHeight(const Window& w){ return WindowHeight(w.GetHWND()); }