I am trying to change my application\' s title bar and border colors programmatically. I tried lots of things but with no success, and decided to change these colors system-
I know you are using C++, but I am handy with C#. So that you may get some idea, take look at the following code, which modifies form appearance.
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("User32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hWnd);
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
const int WM_NCPAINT = 0x85;
if (m.Msg == WM_NCPAINT)
{
IntPtr hdc = GetWindowDC(m.HWnd);
if ((int)hdc != 0)
{
Graphics g = Graphics.FromHdc(hdc);
g.FillRectangle(Brushes.Green, new Rectangle(0, 0, 4800, 23));
g.Flush();
ReleaseDC(m.HWnd, hdc);
}
}
}
Also, you could use the Drawing Custom Borders in Windows Forms project from CodePlex. This project is a tiny library that allows users to customize Windows Forms, like customizing a windows' non-client area.