Does this just refresh the window? I thought for awhile it was supposed to pretty much erase the window. But i dont'' know, can someone explain the
RedrawWindow ( );
function. Thanks.
- king171@hotmail.com
- http://www.cfxweb.net/mxf/
RedrawWindow ( hwnd, etc....) ;
The RedrawWindow function updates the specified rectangle or region in a window’s client area.
BOOL RedrawWindow( HWND hWnd,
// handle of window
CONST RECT *lprcUpdate,
// address of structure with update rectangle
HRGN hrgnUpdate,
// handle of update region
UINT flags
// array of redraw flags
);
Parameters
hWnd
Identifies the window to be redrawn. If this parameter is NULL, the desktop window is updated.
lprcUpdate
Points to a RECT structure containing the coordinates of the update rectangle. This parameter is ignored if the hrgnUpdate parameter identifies a region.
hrgnUpdate
Identifies the update region. If both the hrgnUpdate and lprcUpdate parameters are NULL, the entire client area is added to the update region.
flags
Specifies one or more redraw flags. This parameter can be a combination of flags that invalidate or validate a window, control repainting, and control which windows are affected by RedrawWindow.
The following flags are used to invalidate the window: Flag (invalidation)
Description
RDW_ERASE
Causes the window to receive a WM_ERASEBKGND message when the window is repainted. The RDW_INVALIDATE flag must also be specified; otherwise, RDW_ERASE has no effect.
RDW_FRAME
Causes any part of the nonclient area of the window that intersects the update region to receive a WM_NCPAINT message. The RDW_INVALIDATE flag must also be specified; otherwise, RDW_FRAME has no effect. The WM_NCPAINT message is typically not sent during the execution of RedrawWindow unless either RDW_UPDATENOW or RDW_ERASENOW is specified.
RDW_INTERNALPAINT
Causes a WM_PAINT message to be posted to the window regardless of whether any portion of the window is invalid.
RDW_INVALIDATE
Invalidates lprcUpdate or hrgnUpdate (only one may be non-NULL). If both are NULL, the entire window is invalidated.
The following flags are used to validate the window: Flag (validation)
Description
RDW_NOERASE
Suppresses any pending WM_ERASEBKGND messages.
RDW_NOFRAME
Suppresses any pending WM_NCPAINT messages. This flag must be used with RDW_VALIDATE and is typically used with RDW_NOCHILDREN. RDW_NOFRAME should be used with care, as it could cause parts of a window to be painted improperly.
RDW_NOINTERNALPAINT
Suppresses any pending internal WM_PAINT messages. This flag does not affect WM_PAINT messages resulting from a non-NULL update area.
RDW_VALIDATE
Validates lprcUpdate or hrgnUpdate (only one may be non-NULL). If both are NULL, the entire window is validated. This flag does not affect internal WM_PAINT messages.
The following flags control when repainting occurs. RedrawWindow will not repaint unless one of these flags is specified. Flag
Description
RDW_ERASENOW
Causes the affected windows (as specified by the RDW_ALLCHILDREN and RDW_NOCHILDREN flags) to receive WM_NCPAINT and WM_ERASEBKGND messages, if necessary, before the function returns. WM_PAINT messages are received at the ordinary time.
RDW_UPDATENOW
Causes the affected windows (as specified by the RDW_ALLCHILDREN and RDW_NOCHILDREN flags) to receive WM_NCPAINT, WM_ERASEBKGND, and WM_PAINT messages, if necessary, before the function returns.
By default, the windows affected by RedrawWindow depend on whether the given window has the WS_CLIPCHILDREN style. Child windows that are not the WS_CLIPCHILDREN style are unaffected; non-WS_CLIPCHILDREN windows are recursively validated or invalidated until a WS_CLIPCHILDREN window is encountered. The following flags control which windows are affected by the RedrawWindow function: Flag
Description
RDW_ALLCHILDREN
Includes child windows, if any, in the repainting operation.
RDW_NOCHILDREN
Excludes child windows, if any, from the repainting operation.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
When RedrawWindow is used to invalidate part of the desktop window, the desktop window does not receive a WM_PAINT message. To repaint the desktop, an application uses the RDW_ERASE flag to generate a WM_ERASEBKGND message.
BOOL RedrawWindow( HWND hWnd,
// handle of window
CONST RECT *lprcUpdate,
// address of structure with update rectangle
HRGN hrgnUpdate,
// handle of update region
UINT flags
// array of redraw flags
);
Parameters
hWnd
Identifies the window to be redrawn. If this parameter is NULL, the desktop window is updated.
lprcUpdate
Points to a RECT structure containing the coordinates of the update rectangle. This parameter is ignored if the hrgnUpdate parameter identifies a region.
hrgnUpdate
Identifies the update region. If both the hrgnUpdate and lprcUpdate parameters are NULL, the entire client area is added to the update region.
flags
Specifies one or more redraw flags. This parameter can be a combination of flags that invalidate or validate a window, control repainting, and control which windows are affected by RedrawWindow.
The following flags are used to invalidate the window: Flag (invalidation)
Description
RDW_ERASE
Causes the window to receive a WM_ERASEBKGND message when the window is repainted. The RDW_INVALIDATE flag must also be specified; otherwise, RDW_ERASE has no effect.
RDW_FRAME
Causes any part of the nonclient area of the window that intersects the update region to receive a WM_NCPAINT message. The RDW_INVALIDATE flag must also be specified; otherwise, RDW_FRAME has no effect. The WM_NCPAINT message is typically not sent during the execution of RedrawWindow unless either RDW_UPDATENOW or RDW_ERASENOW is specified.
RDW_INTERNALPAINT
Causes a WM_PAINT message to be posted to the window regardless of whether any portion of the window is invalid.
RDW_INVALIDATE
Invalidates lprcUpdate or hrgnUpdate (only one may be non-NULL). If both are NULL, the entire window is invalidated.
The following flags are used to validate the window: Flag (validation)
Description
RDW_NOERASE
Suppresses any pending WM_ERASEBKGND messages.
RDW_NOFRAME
Suppresses any pending WM_NCPAINT messages. This flag must be used with RDW_VALIDATE and is typically used with RDW_NOCHILDREN. RDW_NOFRAME should be used with care, as it could cause parts of a window to be painted improperly.
RDW_NOINTERNALPAINT
Suppresses any pending internal WM_PAINT messages. This flag does not affect WM_PAINT messages resulting from a non-NULL update area.
RDW_VALIDATE
Validates lprcUpdate or hrgnUpdate (only one may be non-NULL). If both are NULL, the entire window is validated. This flag does not affect internal WM_PAINT messages.
The following flags control when repainting occurs. RedrawWindow will not repaint unless one of these flags is specified. Flag
Description
RDW_ERASENOW
Causes the affected windows (as specified by the RDW_ALLCHILDREN and RDW_NOCHILDREN flags) to receive WM_NCPAINT and WM_ERASEBKGND messages, if necessary, before the function returns. WM_PAINT messages are received at the ordinary time.
RDW_UPDATENOW
Causes the affected windows (as specified by the RDW_ALLCHILDREN and RDW_NOCHILDREN flags) to receive WM_NCPAINT, WM_ERASEBKGND, and WM_PAINT messages, if necessary, before the function returns.
By default, the windows affected by RedrawWindow depend on whether the given window has the WS_CLIPCHILDREN style. Child windows that are not the WS_CLIPCHILDREN style are unaffected; non-WS_CLIPCHILDREN windows are recursively validated or invalidated until a WS_CLIPCHILDREN window is encountered. The following flags control which windows are affected by the RedrawWindow function: Flag
Description
RDW_ALLCHILDREN
Includes child windows, if any, in the repainting operation.
RDW_NOCHILDREN
Excludes child windows, if any, from the repainting operation.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
When RedrawWindow is used to invalidate part of the desktop window, the desktop window does not receive a WM_PAINT message. To repaint the desktop, an application uses the RDW_ERASE flag to generate a WM_ERASEBKGND message.
Zipster i have the documentation... thanks anyways. Anyone else want to try and explain it, in their own words?
Thanks, nice try.
- king171@hotmail.com
- http://www.cfxweb.net/mxf/
Thanks, nice try.
- king171@hotmail.com
- http://www.cfxweb.net/mxf/
from what i can gather, RedrawWindow(hwnd...) just redraws the window if something happens to it. Perhaps someone switched out of the application and moved another window on top of your application, this paticular function would redraw some or all of the window.
now, i''m by no means an expert ( in fact, i''m a newbie on the subject :p ) but perhaps my explanation is somewhat close
now, i''m by no means an expert ( in fact, i''m a newbie on the subject :p ) but perhaps my explanation is somewhat close
Well without the function (which my program is) it redraws itself fine. So i don''t know of thats right.
- king171@hotmail.com
- http://www.cfxweb.net/mxf/
- king171@hotmail.com
- http://www.cfxweb.net/mxf/
are you using WM_PAINT or any of that jive?
or just going without anything of the sort?
or just going without anything of the sort?
I''m using WM_PAINT, the reason i have this post is to see what function would clear a window. I really want to press a button, and have the windows content(such as text or pictures) to clear.
- king171@hotmail.com
- http://www.cfxweb.net/mxf/
- king171@hotmail.com
- http://www.cfxweb.net/mxf/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement