How WM_PAINT message gets called in MFC,please explain it .
a)Who calls the WM_PAINT message?
b)When it gets called?
c)how it comes to message queue?

Please Explain it

Answer Posted / saurabh shakya

n the preceding two examples, a CClientDC object was used to draw in the client area. This approach has the shortcoming that when the window is resized, the graphics are not repainted; in the preceding examples, they must be restored by again choosing the menu item. Using a CPaintDC object and putting the graphics calls into the OnPaint() function changes this behavior, so that the graphics are redrawn each time a WM_PAINT message is sent. This is done in all subsequent examples.

Windows OS sets the paint flag whenever a window gains one or more pixels. Windows OS sends a WM_PAINT message to the window whenever the client area needs to be repainted. When there are no higher-priority messages to be processed, the WM_PAINT message is processed and the window is repainted. The WM_PAINT message will be sent whenever any of the following events occur:

• The window has one or more invalid regions. (This is caused by one or more previously hidden areas of the window being brought back into view. Your window is brought back into view when a window that was above your window is closed or moved. Windows OS keeps track of all the invalid regions since the last repainting occurred and will repaint the invalid rectangle that encloses all invalid regions.)
• The user resizes the window.
• Part of the client area is scrolled.
• The application invalidates the client area, using one of the function calls: CWnd::Invalidate(), CWnd::InvalidateRect(), or CWnd::InvalidateRgn().

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is functioning of DIalodDataXchange ..?

1196


How to handle dynamic menus in mfc? What happens when client calls cocreateinstance?

698


List out the basic features of MFC.

13703


How do I create a dialog box in mfc?

613


What is mfc class hierarchy?

623






2.create for 10 batch: Employee_Number Employee_name Employee_Dateofjoining Employee_address Employee_salary 1.select the employee name who deriving more than 10 thousand salary and joined before august 08. use structure and pointers

1811


what is the meaning of constant FILE EXCEEDS LENGTH LIMIT while loading from ps file to vsam in the jcl?

3346


what message is sent to an application when the user presses the primary button?

1388


What is the difference between Struts and JSF? Pls list some most suitable differences.

2847


What does mfc stand for?

961


I want recent paper pattern for HP company?

1791


how to repaint when working with horizontal scroll bar

1549


plzz tell me what we can do and dont in tally ERP & sap business one?

1882


Do you have an idea about MFC?

920