Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is MFC UpdateAllViews blocking or non blocking?

I have a MFC code based on Document View framework. I use UpdateAllViews(nullptr,0,nullptr) from Document class to invoke the View's OnDraw member function.

void MyDocumentClass::MyFunction()
{
    //.. Document code to create and process data
    UpdateAllViews(nullptr,0,nullptr) // Invokes OnDraw
    // When does program control reach this line? 
}

My question is, please tell me if the UpdateAllViews function is blocking or non blocking, when does program control reach the line next to UpdateAllViews()? Does it reach there after all the code in OnDraw() has finished executing, or does it reach there sooner?

like image 336
The Vivandiere Avatar asked Jan 09 '23 23:01

The Vivandiere


1 Answers

UpdateAllViews is a nonblocking function that simply calls OnUpdate of each view. The OnUpdate function typically invalidates the view, which will cause OnDraw later. UpdateAllViews returns after the invalidating and before the painting.

like image 185
ScottMcP-MVP Avatar answered Jan 19 '23 03:01

ScottMcP-MVP