Adapt the window color under WinXP

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Adapt the window color under WinXP

Post by BackupUser »

Code updated For 5.20+

Restored from previous forum. Originally posted by Franco.

Under WinXP some forms look very ugly because the window color is not automaticly the same like under Win9x.
To adapt the window color under WinXP use this:

Code: Select all

Procedure ColorizeWindow(Color)  
  Brush.LOGBRUSH\lbColor = GetSysColor_(Color)
  SetClassLong_(WindowID(0),#GCL_HBRBACKGROUND,CreateBrushIndirect_(Brush))
  RedrawWindow_(WindowID(0),0,0,7)
EndProcedure
 
;..... more code
 
OpenWindow(........
 
ColorizeWindow(#COLOR_BTNFACE) ;<- same color as textgadgets or buttons...
If you want another color that changes automaticly with the theme choose one
of the following flags specifying which system color to get:

#COLOR_3DDKSHADOW
The dark shadow color for 3D objects.
#COLOR_3DFACE, #COLOR_BTNFACE
The face color for 3D objects.
#COLOR_3DHILIGHT, #COLOR_3DHIGHLIGHT, #COLOR_BTNHILIGHT, #COLOR_BTNHIGHLIGHT
The highlight (opposite of shadow) color for 3D objects.
#COLOR_3DLIGHT
The light (opposite of shadow) color for 3D objects.
#COLOR_3DSHADOW, #COLOR_BTNSHADOW
The shadow color for 3D objects.
#COLOR_ACTIVEBORDER
The active window border color.
#COLOR_ACTIVECAPTION
The active window title bar color. Windows 98, 2000: The color of the left side of the active window title bar gradient, if the gradient effect is used.
#COLOR_APPWORKSPACE
The background color of multiple document interface (MDI) windows.
#COLOR_BACKGROUND, #COLOR_DESKTOP
The desktop color.
#COLOR_BTNTEXT
The text color for pushbuttons.
#COLOR_CAPTIONTEXT
The color of window caption text, size boxes, and scroll bar arrow boxes.
#COLOR_GRADIENTACTIVECAPTION
Windows 98, 2000: The color of the right side of the active window title bar gradient, if the gradient effect is used.
#COLOR_GRADIENTINACTIVECAPTION
Windows 98, 2000: The color of the right side of an inactive window's title bar gradient, if the gradient effect is used.
#COLOR_GRAYTEXT
The color for disabled (grayed-out) text.
#COLOR_HIGHLIGHT
The color used to highlight selected items.
#COLOR_HIGHLIGHTTEXT
The color used for the text of highlighted items.
#COLOR_HOTLIGHT
Windows 98, 2000: The color of a hot-tracked item, which is executed with a single click.
#COLOR_INACTIVEBORDER
The color of an inactive window's border.
#COLOR_INACTIVECAPTION
The color of an inactive window's caption. Windows 98, 2000: The color of the right side of an inactive window's title bar gradient, if the gradient effect is used.
#COLOR_INACTIVECAPTIONTEXT
The color of an inactive window's caption text.
#COLOR_INFOBK
The background color for tooltop controls.
#COLOR_INFOTEXT
The text color for tooltip controls.
#COLOR_MENU
The background color of menus.
#COLOR_MENUTEXT
The color of menu text.
#COLOR_SCROLLBAR
The color of a scroll bar's gray area.
#COLOR_WINDOW
The background color of a window.
#COLOR_WINDOWFRAME
The color of a window frame.
#COLOR_WINDOWTEXT
The color of text in a window.


Have a nice day...
Franco

Edited by - franco on 24 December 2001 02:01:37
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

thx Franco!

I just got this Problem and now it`s solved.

Nice work!
Post Reply