Ejemplo n.º 1
0
void CViewStatistics::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();

	m_pDoc       = (CGnucleusDoc*) GetDocument();
	m_autNetwork = m_pDoc->m_autNetwork;

	// Property Sheets
	m_TabMain		  = new CStatisticsMain(this);
	m_TabDistribution = new CStatisticsDistribution(this);
	m_TabPackets	  = new CStatisticsPackets(this);
	m_TabBandwidth	  = new CStatisticsBandwidth(this);
	m_TabLog		  = new CStatisticsLog;
	m_TabMemory		  = new CStatisticsMemory(this);
	m_TabError		  = new CStatisticsError(this);

	//m_pSheet.AddPage(m_TabMain);
	//m_pSheet.AddPage(m_TabDistribution);
	//m_pSheet.AddPage(m_TabPackets);
	//m_pSheet.AddPage(m_TabBandwidth);
	m_pSheet.AddPage(m_TabLog);
	//m_pSheet.AddPage(m_TabMemory);
	//m_pSheet.AddPage(m_TabError);

	CreatePropSheet(this, &m_pSheet);
	SizePropSheet(this, &m_pSheet, IDC_PSHEET_AREA);

	for(int i = 0; i < m_pSheet.GetPageCount(); ++i)
		m_pSheet.SetActivePage(i);
	m_pSheet.SetActivePage(0);

	// Set Title
	//m_TimeStarted = CTime::GetCurrentTime();
	//GetParentFrame()->SetWindowText("Statistics - " + m_TimeStarted.Format("%I:%M %p"));

	// Connected Nodes listbox
	int offSet = m_lstNodes.GetScrollLimit(SB_VERT) ? ::GetSystemMetrics(SM_CXVSCROLL) + 3 : 4;

	CRect rect;
	m_lstNodes.GetWindowRect(&rect);

	m_lstNodes.InsertColumn( 0, "Node", LVCFMT_LEFT,  rect.Width() - offSet, 0);
	m_lstNodes.InsertColumn( 1, "Type", LVCFMT_LEFT, (rect.Width() - offSet) * 0.5, 1);

	m_lstNodes.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
	
	// Size all the controls in proportion to the size
	RECT rWin;
	GetClientRect(&rWin);
	OnSize(SIZE_RESTORED, rWin.right, rWin.bottom);

	m_pDoc->m_pViewStatistics.push_back( GetSafeHwnd() );

	OnSockUpdate();
	/*m_TabDistribution->UpdateDistribution();
	m_TabPackets->UpdateData();
	m_TabBandwidth->UpdateBandwidth();*/
}
Ejemplo n.º 2
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                       HINSTANCE hPrevInstance,
                       LPTSTR    lpCmdLine,
                       int       nCmdShow)
{
    MSG msg;
    HACCEL hAccelTable;

    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);
    UNREFERENCED_PARAMETER(nCmdShow);

    /*
     * Initialize this instance of MSConfig. Quit if we have
     * another instance already running.
     */
    if (!Initialize(hInstance))
        return -1;

    // hInst = hInstance;

    hMainWnd = CreatePropSheet(hInstance, NULL, szAppName);
    if (!hMainWnd)
    {
        /* We failed, cleanup and bail out */
        Cleanup();
        return -1;
    }

    hAccelTable = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDR_MSCONFIG));

    /* Message loop */
    while (IsWindow(hMainWnd) && GetMessageW(&msg, NULL, 0, 0))
    {
        /*
         * PropSheet_GetCurrentPageHwnd returns NULL when the user clicks the OK or Cancel button
         * and after all of the pages have been notified. Apply button doesn't cause this to happen.
         * We can then use the DestroyWindow function to destroy the property sheet.
         */
        if (PropSheet_GetCurrentPageHwnd(hMainWnd) == NULL)
            break;

        /* Process the accelerator table */
        if (!TranslateAcceleratorW(hMainWnd, hAccelTable, &msg))
        {
            /*
             * If e.g. an item on the tree view is being edited,
             * we cannot pass the event to PropSheet_IsDialogMessage.
             * Doing so causes the property sheet to be closed at Enter press
             * (instead of completing edit operation).
             */
            if (/*g_bDisableDialogDispatch ||*/ !PropSheet_IsDialogMessage(hMainWnd, &msg))
            {
                TranslateMessage(&msg);
                DispatchMessageW(&msg);
            }
        }
    }

    // FIXME: Process the results of MSConfig !!

    /* Destroy the accelerator table and the window */
    if (hAccelTable != NULL)
        DestroyAcceleratorTable(hAccelTable);

    DestroyWindow(hMainWnd);

    /* Finish cleanup and return */
    Cleanup();
    return (int)msg.wParam;
}
Ejemplo n.º 3
0
long FAR PASCAL 
WinWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HICON hIcon;
	FARPROC lpDlg = (FARPROC)NULL;
	LPNMHDR pnmh;

	pnmh = (LPNMHDR) lParam; 

	switch (message) {
	case WM_CREATE:
		hInstance = ( ( LPCREATESTRUCT )lParam )->hInstance;
		InitCommonControls();
        CreateToolbar(hWnd);
		CreateStatusBar(hWnd);
		break;
	case WM_MENUSELECT:
		GetMenuSelect (hWndStatus, message, wParam, lParam);
		break;
	case WM_NOTIFY:
		switch (pnmh->code)
		{
			case TTN_NEEDTEXT:
				GetToolTipText((LPTOOLTIPTEXT)lParam);
				break;
			default:
				return (DefWindowProc(hWnd, message, 
					wParam, lParam));
		}	
		break;
	case WM_COMMAND:
        	switch (wParam) {
        	case IDM_ABOUT:
               		hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
	       		    ShellAbout(hWnd, Program, Title, hIcon);
               		DestroyIcon(hIcon);
               		break;
	    	case IDM_UPDOWN:
               		if ( DialogBox ( hInstance, MAKEINTRESOURCE 
					( IDD_UPDOWNTEST ), hWnd,
                     			(DLGPROC)UpDownProc ) == -1 )
                       		MessageBox ( hWnd, "Dialog Failed", "Error", 
						MB_OK);
	       	    	break;
			case IDM_PROPSHEET:
					CreatePropSheet(hWnd);
					break;
			case IDM_EXIT:
	       		DestroyWindow(hWnd);
	       		break;
          	 }
	break;
	case WM_SIZE:
       		SendMessage(hWndToolbar, message, wParam, lParam);
     		SendMessage(hWndStatus, message, wParam, lParam);
       		switch (wParam) {
       		case SIZEICONIC:
	    		MessageBeep(0);
           	}
           	break;
    	    case WM_DESTROY:
       		    PostQuitMessage(0);
        	    break;
	default:
        	return (DefWindowProc(hWnd, message, wParam, lParam));
	}
	return (0);
}