January 26th, 2004

The hollow brush

What is the hollow brush for? The hollow brush is a brush that doesn’t do anything. You can use it when you’re forced to use a brush but you don’t want to. As one example, you can use it as your class brush. Then when your program stops responding and Windows decide to do the “white flash” (see yesterday’s entry), it grabs the hollow brush and ends up not drawing anything. (At least, that’s how it worked on Windows 2000. Things may be different on XP.)

Another place you can use the hollow brush is when handling the WM_CTLCOLOR* messages. Those messages require you to return a brush, which will be used to erase the background. If you don’t want to erase the background, a hollow brush does the trick.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.