Title bar colour

Is it possible to tweak the title bar's colour and set it by ourselves?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the SetSysColors function with the following elements.

It will take more than a tweak.
I assume that you don't want to change the title bar of _all_ windows.

I found this microsoft article on the subject:
HOWTO: Draw a Custom Window Caption

explanations, sample code etc...

Good luck, Mike
AphroditusAuthor Commented:
I am a real beginner and would like further explanation on how to do this on a dialog box's caption bar instead of the mainframe's...
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

There's no one-liner that does this.

You'll have to create a new class of dialog box and override some methods.

Is there something at http://support.microsoft.com/support/kb/articles/Q99/0/46.ASP that you don't understand?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AphroditusAuthor Commented:
may i know which methods of the dialog box must i override...

I don't understand how dialog boxes handle their caption bar. Hope you could shine some light here.
You'll have to add handlers for

Use the class wizard to create OnNcPaint and OnNcActivate for you. Call the default implementations: CDialog::OnNcPaint and CDialog::OnNcActivate and then do your own thing similar to microsoft's page.

Try to expand on the following:

void CTestingDlg::OnNcPaint()
    RECT rc1, rc2;

    // Let Windows do what it usually does. Let the window caption
    // be empty to avoid any Windows-initiated caption bar drawing

    CDC *pDC = GetWindowDC();
    GetWindowRect( (LPRECT)&rc2 );

    // Compute the caption bar's origin. This window has a system box
    // a minimize box, a maximize box, and has a resizeable frame

    int x = GetSystemMetrics( SM_CXSIZE ) +
        GetSystemMetrics( SM_CXBORDER ) +
        GetSystemMetrics( SM_CXFRAME );
    int y = GetSystemMetrics( SM_CYFRAME );
        rc1.left = x;
        rc1.top = y;

    // 2*x gives twice the bitmap+border+frame size. Since there are
    // only two bitmaps, two borders, and one frame at the end of the
    // caption bar, subtract a frame to account for this.

    rc1.right = rc2.right - rc2.left - 2*x -
        GetSystemMetrics( SM_CXFRAME );
    rc1.bottom = GetSystemMetrics( SM_CYSIZE );

    // Render the caption. Use your own color...

    COLORREF cr = pDC->SetBkColor( 0x00777777 );
    pDC->DrawText( (LPSTR)"Left Justified Caption", -1,
        (LPRECT)&rc1, DT_LEFT );
    pDC->SetBkColor( cr );
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.