views:

29

answers:

1

I develop a MFC dialog-based application in VC++6.0 which communicate with remote machines through UART port, data received should be displayed in charting control(plot pack). Because the amount of remote machines is determined at running time by user, so I create charting dialog dynamically with user setted amount of remote machines. A tabCtrl is put on the main dialog(m_TabPlot), the amount of tabCtrl's items will be created when user determined amount of remote machines, define an pointer array pDlgPlotList[] to save the address of created charting dialogs. I create a dialog with dialog editor, and put the activeX control iplotX on the dialog which I named DlgPlot. just like this:

   CDlgPlot *pDlgPlot = new CDlgPlot;
    pDlgPlotList[no] = pDlgPlot;

    m_TabPlot.InsertItem(no, itemText);
    pDlgPlot->Create(IDD_DLG_PLOT, GetDlgItem(IDC_TAB_PLOT));

    CRect tabRect, itemRect;
    int nX, nY, nXc, nYc;

    m_TabPlot.GetClientRect(&tabRect);
    m_TabPlot.GetItemRect(0, &itemRect);

    nX=itemRect.left;
    nY=itemRect.bottom+1;
    nXc=tabRect.right-itemRect.left-1;
    nYc=tabRect.bottom-nY-1;

    pDlgPlotList[no]->SetWindowPos( &wndTop,  nX, nY, nXc, nYc, SWP_SHOWWINDOW );

Communication with remote machines throung UART using MSCOMM activeX control, every time received data, add new point in Plot pack control using AddXY(x,y) function, I write AddXY() in OnComm() function of MSCOMM, but not in OnPaint() of CDlogPlot, so maybe this is the reason why my charting dialog updating is wrong. when my app is running, the history curve cannot be shown if my app turned to background and turn back, except new data point added to m_Plot, or I click the activeX control then history curve can be shown. I'm sure the WM_PAINT message is received by DlgPlot(I use SPY++ to find what messages transfered), maybe I do nothing in OnPaint() function of DlgPlot? if so, what can I do in it? your help will be appreciated!

A: 

No one knows the reason? how to update charting control correctly?