SmartErase!
Posted: Tue Mar 17, 2009 3:47 pm
Update. 18th March 2009.
If you apply SmartErase to a particular window/control, but wish to exlude some child control or other from being removed from the erasing process (such as a toolbar), then simply set a Window property for the child control as follows :
This child will then not be excluded from the erasing of it's parent.
Useful for keeping PB toolbars transparent etc. (See post below regarding toolbars).
You will of course need to remove this property yourself before you destroy the control in question. I did not automate this because SmartErase would then have to subclass the control in order to remove the property and that seemed like overkill in this case.
Download is through the nxSoftware site.
=============================================
Hi,
on a drive to reduce flicker in an application I am working upon when the user resizes the main window prompted me to create this little utility (Windows only).
It is similar to SmartWindowRefresh() in the way it is used, but (and I have never had any success with SmartWindowRefresh()) in tests, SmartErase has resulted in some drastic reductions in flicker.
Like SmartWindowRefresh(), SmartErase() is not guaranteed to work with any particular project. Unlike SmartWindowRefresh(), however, you apply SmartErase() not necessarily to an entire window, but to individual windows or parent controls as appropriate. Like SmartWindowRefresh(), SmartErase() would ideally be used in combination with other techniques (such as using #WS_CLIPCHILDREN and so on) for reducing flicker.
The idea is that you would generally apply ‘SmartErase’ to a parent window/control (e.g. a container gadget) whose child gadgets flicker inordinately when dynamically resized etc. SmartErase() will then assume responsibility for erasing that window/control's background whilst following certain rules (e.g. ignore all child windows) etc. SmartErase() can even be instructed to bypass all erasing for a particular window/control which is useful if the window is completely covered by child controls etc.
Very simple, quite crude, but with the 6 demo programs tested on XP and Vista, it can be damn effective!
The download includes the full source, six demos and a very short user manual. Please read the manual before attempting to use this utility as it contains some important info.
All of the the demo programs have SmartErase() disabled. Run them with xp themes enabled and resize the main window to see some appalling flicker. Then uncomment the appropriate line(s) to see the effect SmartErase() may or may not be having.
My thanks to Kinglestat for helping to test the code and the demos.
Please proceed to the nxSoftware site for the download (Freeware section).
Regards.
If you apply SmartErase to a particular window/control, but wish to exlude some child control or other from being removed from the erasing process (such as a toolbar), then simply set a Window property for the child control as follows :
Code: Select all
SetProp_(childHwnd, #SmartErase_IGNORECHILD, 1)
Useful for keeping PB toolbars transparent etc. (See post below regarding toolbars).
You will of course need to remove this property yourself before you destroy the control in question. I did not automate this because SmartErase would then have to subclass the control in order to remove the property and that seemed like overkill in this case.
Download is through the nxSoftware site.
=============================================
Hi,
on a drive to reduce flicker in an application I am working upon when the user resizes the main window prompted me to create this little utility (Windows only).
It is similar to SmartWindowRefresh() in the way it is used, but (and I have never had any success with SmartWindowRefresh()) in tests, SmartErase has resulted in some drastic reductions in flicker.
Like SmartWindowRefresh(), SmartErase() is not guaranteed to work with any particular project. Unlike SmartWindowRefresh(), however, you apply SmartErase() not necessarily to an entire window, but to individual windows or parent controls as appropriate. Like SmartWindowRefresh(), SmartErase() would ideally be used in combination with other techniques (such as using #WS_CLIPCHILDREN and so on) for reducing flicker.
The idea is that you would generally apply ‘SmartErase’ to a parent window/control (e.g. a container gadget) whose child gadgets flicker inordinately when dynamically resized etc. SmartErase() will then assume responsibility for erasing that window/control's background whilst following certain rules (e.g. ignore all child windows) etc. SmartErase() can even be instructed to bypass all erasing for a particular window/control which is useful if the window is completely covered by child controls etc.
Very simple, quite crude, but with the 6 demo programs tested on XP and Vista, it can be damn effective!

The download includes the full source, six demos and a very short user manual. Please read the manual before attempting to use this utility as it contains some important info.
All of the the demo programs have SmartErase() disabled. Run them with xp themes enabled and resize the main window to see some appalling flicker. Then uncomment the appropriate line(s) to see the effect SmartErase() may or may not be having.
My thanks to Kinglestat for helping to test the code and the demos.
Please proceed to the nxSoftware site for the download (Freeware section).
Regards.