It's a problem i don't know how to get around

When I create the modal dialog box, the owner window (main application widnow in my case) no longer receives any messages instead, the modal dialog box's message loops begins, so all the drawings I did in WM_PAINT no longer get drawn and I get an error.

The reason of this error i think is that since the window isn't getting any messages, the HDC in it isn't valid any more and that's why i get an error for the drawings in WM_PAINT


is there any function to freeze a window? to keep it in an idle state with all the information in it and receive no message until an opposite function is called ?

If i can do this, I will call this function before creating the modal dialog so i wont get the error of drawing



P.S.: Message boxes also cause the same thing, because there are also modal dialog boxes