Custom Caption Painting

Actually, what I am most interested in, is custom caption buttons.  What I need to know, is how to implement a button which is functionally equivalent to the close, minimize, and maximize buttons, but which has a different bitmap associated with it.  I know the standard caption buttons are drawn with the DrawFrameControl function, but I see no provisions in this function for a user drawn button.  Also, how does one deal with the fact that the size of the title bar can be changed.  Does this rule out using a bitmap to paint the button?  What I would like to have, is an up or down arrow which would allow the user to roll up the client area to 0 in the case of the up arrow, or roll it back to its previous state in the case of the down arrow.  I believe I have seen this functionality in some of Corel Draw's tool bars.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

luisrConnect With a Mentor Commented:
Paul DiLascia wrote a CCaptionPainter class that makes painting your own title bar a snap (you only worry on painting, not anything else). It appeared in the June 1997 issue of MSJ.

You can download the code from or read the article in MSDN.
dereklAuthor Commented:
Edited text of question.
First, leave the close, max, and min buttons alone. These are standard and you will only confuse users by altering their appearance.

See :

If you read thru there, you'll never consider changing Windows standard features again! LOL

Re the arrow to roll the client area up and down. Neat idea. Why not put these on a toolbar?
At the handler for the new button, use SendMessage to send WM_SYSCOMMAND to the window.  Use the following for wParam:

SC_CLOSE for Close
SC_MAXIMIZE for Maximize
SC_MINIMIZE for Minimize
SC_RESTORE for Restore

The lParam in this case is not used.

Hope it helps!


(I wish the email notification check mark in this box would remain checked as default, I always forget to check the checkbox)

All Courses

From novice to tech pro — start learning today.