Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

m_graph.ImmediateUpdates = FALSE?

I really thank you for your kind answers for my recent questions.

Today, I would like to know how I can count the ignored(skipped) plots when I apply CNiGraph property, CNiGraph.ImmediateUpdates = FALSE.

I used this property for the program which plots a lot of data with very fast update rate. Therefore, my program does not shows all data. It skips some data when CPU performance is full. It is okay for me (it is actually what I want.) However, I still want to know how many plots are skipped.

I tried as follows:

- Header File
class CMyDlg : public CDialog
{
public:
m_SendCnt;
m_ReceiveCnt;
}

- Source File

BOOL CMyDlg::OnInitDialog(
{
m_SendCnt = 0;
m_ReceiveCnt = 0;
m_graph.ImmediateUpdates = FALSE;

....
}

void OnStartMyProgram()
{
....
AfxBeginThread(MyThreadProc,this)
....
}

UINT MyThreadProc(LPVOID lParam)
{
CMyDlg* pDlg = (CMyDlt*)lParam;
....
while(iRun) {
Sleep(SMALL_INTERVAL);
....
pDlg->PostMyMessage(WM_MYMESSAGE,0,0);
m_SentCnt++;
}
return (UINT)0;
}

LRESULT CMyDlg::OnMyMessage(WPARAM wParam, LPARAM lParam)
{
....
m_ReceiveCnt++;
....
m_graph.PlotY(tWaveMatrix);
CString sTr;
sTr.Format("SendCnt = %d, ReceiveCnt = %d",
m_SendCnt, m_ReceiveCnt);
m_graph.SetCaption(sTr);

return (LRESULT)0;
}

The results are ...
1) Data is skipped as I explained.
2) Caption changes as the following order..(for example)
SendCnt = 3, ReceiveCnt = 3
SendCnt = 6, ReceiveCnt = 6
SendCnt = 9, ReceiveCnt = 9
....

That is, two plots are skipped. However, I do not know how many plots are skipped in the program. The message is received all the time, but m_graph decide whether it display it or not by itself.

Summay of My Questions...
1) How can I count the ignored(skipped) plots
2) Is there any method to know the status of m_graph? I want to know whether it is drawing and it is waiting. (I tried CNiGraph.ReadyStatus, but it was not).
0 Kudos
Message 1 of 2
(2,953 Views)
"The message is received all the time, but m_graph decide whether it display it or not by itself.

...

1) How can I count the ignored(skipped) plots"

The graph doesn't decide to display itself or not when ImmediateUpdates is FALSE - Windows makes this decision. When ImmediateUpdates is FALSE, plotting will result in a WM_PAINT message for part of the graph in the application message queue and the graph will eventually update when the system dispatches that message to the window procedure of the graph. If you're updating at a fast rate, Windows may drop some WM_PAINT messages because it is a low priority message. When ImmediateUpdates is TRUE, plotting still results in a WM_PAINT message, but the graph will also call UpdateWindow so that the WM_PAINT message will be sent directly to the graph's window procedure and skip the application message queue.

"2) Is there any method to know the status of m_graph? I want to know whether it is drawing and it is waiting. (I tried CNiGraph.ReadyStatus, but it was not)."

The graph does not provide a way to determine this. One way you could do this is subclass the graph window, set a flag when a WM_PAINT message comes in, forward the WM_PAINT message to the original window procedure, then reset the flag after the original window procedure has processed the WM_PAINT message.

- Elton
Message 2 of 2
(2,953 Views)