pLineSerie1 - & gt; ClearSerie ();
PLineSerie1 - & gt; AddPoints (x, dYValue, DATA_COUNT);
Coordinate curve, run after a period of time will appear error, afxwin1. Ini 666 lines of error, the error code is:
VERIFY (: : GetTextExtentPoint32 (m_hAttribDC lpszString, nCount, & amp; The size));
Baidu, I found there is a post and I like
http://bbs.csdn.net/topics/270071437
Probably reason is "working point thread calls to add the function of AddPoint (), AddPoint before () returns to call CWnd: : Invalidate () let ChartCtrl client area is Invalid, and generate a WM_PAINT message to the window of the message queue, not before the WM_PAINT message processing, such as Invalid () is returned, before drawing, should the CDC object may also be of the client area is Invalid,
But if at the same time, the worker threads to refresh window, using the CDC object of the client area of CChartCtrl may be rejected (in call Invalidate (), before the WM_PAINT message processing), so caused the GetTextPoint32 () function failure "
But how to solve this problem, drawing prohibit any home screen refresh, or main interface drawing ban drawing graph
CodePudding user response:
Multiple Threads in the User Interface of http://msdn.microsoft.com/zh-cn/library/ms810439.aspxCodePudding user response:
In the thread interface is more troublesome thing,PLineSerie1 - & gt; ClearSerie ();
PLineSerie1 - & gt; AddPoints (x, dYValue, DATA_COUNT);
These two lines of code is invoked in the thread?
If you can use a button to test? In the event of the button calls it, look to whether can appear error,
To control automatically refresh, in fact if your code is still in operation? Or completely by the control points to draw lines according to offer? If entirely control their picture, it should be to control their own problems, can consider to try a different version
CodePudding user response:
Try to add data before locking the refresh, add the unlockedPCtrl - & gt; LockWindowUpdate ();
PCtrl - & gt; XXXXXXXX
PCtrl - & gt; UnlockWindowUpdate ();
PCtrl - & gt; Refresh
CodePudding user response:
Multithreaded MFC form control is very troublesome, prone to an estimated error, I am currently used method is to use STD: : condition_variable: : notify_one () + STD: : mutex waiting thread mechanism, avoid frequent, control object of duplicate messagesCodePudding user response: