-
Apr 25th, 2002, 07:45 AM
#1
Thread Starter
Addicted Member
how to get Windows title bar color set in system
how i can color of window's title bar which is set in system in Desktop settings .. I ve tried with Getsyscolors but in that i couldnt find parameter value for Active Title Bar . Any one know abt this parameter or how to get window's Title bar color wheter its using 1 color or combination of 2 colors ....
Chander
Email:chander@myrealbox.com
-
Apr 25th, 2002, 07:49 AM
#2
Bouncy Member
you mean this
VB Code:
Private Sub Form_Load()
Me.BackColor = vbActiveTitleBar
End Sub
?
-
Apr 25th, 2002, 08:00 AM
#3
Thread Starter
Addicted Member
will it give me the color of global window's title bar color i meant what is set in Active Title bar color in Desktop settings ???
Chander
Email:chander@myrealbox.com
-
Apr 25th, 2002, 08:43 AM
#4
Play around with this
VB Code:
Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
Const COLOR_SCROLLBAR = 0 'The Scrollbar colour
Const COLOR_BACKGROUND = 1 'Colour of the background with no wallpaper
Const COLOR_ACTIVECAPTION = 2 'Caption of Active Window
Const COLOR_INACTIVECAPTION = 3 'Caption of Inactive window
Const COLOR_MENU = 4 'Menu
Const COLOR_WINDOW = 5 'Windows background
Const COLOR_WINDOWFRAME = 6 'Window frame
Const COLOR_MENUTEXT = 7 'Window Text
Const COLOR_WINDOWTEXT = 8 '3D dark shadow (Win95)
Const COLOR_CAPTIONTEXT = 9 'Text in window caption
Const COLOR_ACTIVEBORDER = 10 'Border of active window
Const COLOR_INACTIVEBORDER = 11 'Border of inactive window
Const COLOR_APPWORKSPACE = 12 'Background of MDI desktop
Const COLOR_HIGHLIGHT = 13 'Selected item background
Const COLOR_HIGHLIGHTTEXT = 14 'Selected menu item
Const COLOR_BTNFACE = 15 'Button
Const COLOR_BTNSHADOW = 16 '3D shading of button
Const COLOR_GRAYTEXT = 17 'Grey text, of zero if dithering is used.
Const COLOR_BTNTEXT = 18 'Button text
Const COLOR_INACTIVECAPTIONTEXT = 19 'Text of inactive window
Const COLOR_BTNHIGHLIGHT = 20 '3D highlight of button
Const COLOR_2NDACTIVECAPTION = 27 'Win98 only: 2nd active window color
Const COLOR_2NDINACTIVECAPTION = 28 'Win98 only: 2nd inactive window color
Private Sub Form_Load()
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
'E-Mail: [email]KPDTeam@Allapi.net[/email]
'Get the caption's active color
col& = GetSysColor(COLOR_ACTIVECAPTION)
'Change the active caption's color to red
t& = SetSysColors(1, COLOR_ACTIVECAPTION, RGB(255, 0, 0))
MsgBox "The old title bar color was" + Str$(col&) + " and is now" + Str$(GetSysColor(COLOR_ACTIVECAPTION))
End Sub
-
Apr 25th, 2002, 10:10 AM
#5
Frenzied Member
If you are drawing your own title bars you should use the DrawFrameCaption API call to draw the various bits...
HTH,
Duncan
-
Apr 25th, 2002, 11:43 PM
#6
Thread Starter
Addicted Member
no i m not making my own frame .. well i think i was looking for COLOR_ACTIVECAPTION constant .. I saw this example fm All Api but didnt get this constant .. well i m going to try this ...
Chander
Email:chander@myrealbox.com
-
Apr 26th, 2002, 05:30 AM
#7
Frenzied Member
The C declaration (from WinUser.h) is:
Code:
#define COLOR_SCROLLBAR 0
#define COLOR_BACKGROUND 1
#define COLOR_ACTIVECAPTION 2
#define COLOR_INACTIVECAPTION 3
#define COLOR_MENU 4
#define COLOR_WINDOW 5
#define COLOR_WINDOWFRAME 6
#define COLOR_MENUTEXT 7
#define COLOR_WINDOWTEXT 8
#define COLOR_CAPTIONTEXT 9
#define COLOR_ACTIVEBORDER 10
#define COLOR_INACTIVEBORDER 11
#define COLOR_APPWORKSPACE 12
#define COLOR_HIGHLIGHT 13
#define COLOR_HIGHLIGHTTEXT 14
#define COLOR_BTNFACE 15
#define COLOR_BTNSHADOW 16
#define COLOR_GRAYTEXT 17
#define COLOR_BTNTEXT 18
#define COLOR_INACTIVECAPTIONTEXT 19
#define COLOR_BTNHIGHLIGHT 20
#if(WINVER >= 0x0400)
#define COLOR_3DDKSHADOW 21
#define COLOR_3DLIGHT 22
#define COLOR_INFOTEXT 23
#define COLOR_INFOBK 24
#endif /* WINVER >= 0x0400 */
#if(WINVER >= 0x0500)
#define COLOR_HOTLIGHT 26
#define COLOR_GRADIENTACTIVECAPTION 27
#define COLOR_GRADIENTINACTIVECAPTION 28
#endif /* WINVER >= 0x0500 */
#if(WINVER >= 0x0400)
#define COLOR_DESKTOP COLOR_BACKGROUND
#define COLOR_3DFACE COLOR_BTNFACE
#define COLOR_3DSHADOW COLOR_BTNSHADOW
#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT
#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT
#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT
#endif /* WINVER >= 0x0400 */
so the VB declaration is:
VB Code:
Private Enum ColourConstatntIndexes
COLOR_SCROLLBAR = 0
COLOR_BACKGROUND = 1
COLOR_ACTIVECAPTION = 2
COLOR_INACTIVECAPTION = 3
COLOR_MENU = 4
COLOR_WINDOW = 5
COLOR_WINDOWFRAME = 6
COLOR_MENUTEXT = 7
COLOR_WINDOWTEXT = 8
COLOR_CAPTIONTEXT = 9
COLOR_ACTIVEBORDER = 10
COLOR_INACTIVEBORDER = 11
COLOR_APPWORKSPACE = 12
COLOR_HIGHLIGHT = 13
COLOR_HIGHLIGHTTEXT = 14
COLOR_BTNFACE = 15
COLOR_BTNSHADOW = 16
COLOR_GRAYTEXT = 17
COLOR_BTNTEXT = 18
COLOR_INACTIVECAPTIONTEXT = 19
COLOR_BTNHIGHLIGHT = 20
COLOR_3DDKSHADOW = 21
COLOR_3DLIGHT = 22
COLOR_INFOTEXT = 23
COLOR_INFOBK = 24
COLOR_HOTLIGHT = 26
COLOR_GRADIENTACTIVECAPTION = 27
COLOR_GRADIENTINACTIVECAPTION = 28
End Enum
HTH,
Duncan
-
Jun 4th, 2018, 01:48 PM
#8
Addicted Member
Re: how to get Windows title bar color set in system
Does this method (eg: COLOR_ACTIVECAPTION) or (vbActiveTitlebar) work consistently for Win10? it seems that an application that i have that works fine on Win7 and WinXP doesn't work accurately on win10 (doesn't show correct color)? Using color = vbActiveTitlebar doesn't seem to show correct color in Win10?
Last edited by Jimboat; Jan 10th, 2021 at 05:05 PM.
/Jimboat
-
Jun 6th, 2018, 06:45 AM
#9
Addicted Member
Re: how to get Windows title bar color set in system
it seems that using GetSysColor doesn't always identify the proper color. For example, if the user has a theme installed that they are using then this does not get the colors that the theme uses, it only gets what the system settings are set to. Is there a way around this?
-
Jun 6th, 2018, 12:43 PM
#10
Re: how to get Windows title bar color set in system
Originally Posted by Jimboat
it seems that using GetSysColor doesn't always identify the proper color. For example, if the user has a theme installed that they are using then this does not get the colors that the theme uses, it only gets what the system settings are set to. Is there a way around this?
1st. Recommend starting your own thread. This one is nearly 20 years old.
2nd. If the window is using a theme, you'll likely want to look at the uxtheme.dll API/functions (XP+)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|