End Google Ads 201810 - BS.net 01 --> I am writing a code to do a long time draw like:
void MyDialog::DoSlowDraw(DWORD tDelay){
while(notFinished){
DrawNextLine(); // like LineTo()....
Sleep(tDelay);
}
}
And it's better to have a "cancel button" because it may take a long time according to tDelay.
---------------------
My try:
To handle "cancle button clicked Message" , Drawing must be done by another thread.
UINT DrawProc( LPVOID pParam )
{
CMyDialog* pform = (CMyDialog*)pParam;
int timeDelay = pform->timeD;
Line_list* pLines = pform->m_pLines;
CClientDC cdc(pform);
//Draw....
It's worked, but as far as I know
1. Work thread should not touch the GUI ---- (Do the drawing).
2. MFC object should not passed to another thread ---- (passing drawing data by CMyDialog*)

Is there a good way to cancle long time drawing.