Results 1 to 4 of 4

Thread: TitleBar Get Color DwmGetColorizationColor

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    332

    TitleBar Get Color DwmGetColorizationColor

    Hi, how can I get the color of the title bar, but the one that uses the Theme in windows 10, try DwmGetColorizationColor, but I can not get the correct color.

    Name:  EJEMPLO.png
Views: 518
Size:  19.6 KB
    leandroascierto.com Visual Basic 6 projects

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    332

    Re: TitleBar Get Color DwmGetColorizationColor

    I think this will be enough, I do not know if it is the right thing to do, if someone has another suggestion I listen.

    Code:
    Option Explicit
    Private Declare Function GetImmersiveUserColorSetPreference Lib "uxtheme.dll" Alias "#98" (ByVal bForceCheckRegistry As Long, ByVal bSkipCheckOnFail As Long) As Long
    Private Declare Function GetImmersiveColorTypeFromName Lib "uxtheme.dll" Alias "#96" (ByVal name As Long) As Long
    Private Declare Function GetImmersiveColorFromColorSetEx Lib "uxtheme.dll" Alias "#95" (ByVal dwImmersiveColorSet As Long, ByVal dwImmersiveColorType As Long, ByVal bIgnoreHighContrast As Long, ByVal dwHighContrastCacheMode As Long) As Long
    Private Declare Function DwmSetWindowAttribute Lib "dwmapi.dll" (ByVal hwnd As Long, ByVal dwAttribute As Long, ByRef pvAttribute As Long, ByVal cbAttribute As Long) As Long
    Private Const DWMNCRP_ENABLED = 2
    Private Const DWMWA_NCRENDERING_POLICY = 2
        
    Public Function GetImmersiveColor(ByVal sName As String) As Long
        Dim lColorSet       As Long
        lColorSet = GetImmersiveUserColorSetPreference(0, 0)
        
        Dim lColorType      As Long
        lColorType = GetImmersiveColorTypeFromName(StrPtr(sName))
        
        Dim lRawColor       As Long
        GetImmersiveColor = GetImmersiveColorFromColorSetEx(lColorSet, lColorType, 0, 0)
    End Function
    
    
    
    Private Sub Form_Load()
        Call DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, DWMNCRP_ENABLED, 4)
        Me.BackColor = GetImmersiveColor("ImmersiveStartSelectionBackground") And &HFFFFFF
    End Sub
    leandroascierto.com Visual Basic 6 projects

  3. #3
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    487

    Re: TitleBar Get Color DwmGetColorizationColor

    The color can be found in the registry

    HKCU
    "Software\Microsoft\Windows\DWM\AccentColor"

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    332

    Thumbs up Re: TitleBar Get Color DwmGetColorizationColor

    Quote Originally Posted by Karl77 View Post
    The color can be found in the registry

    HKCU
    "Software\Microsoft\Windows\DWM\AccentColor"
    THANK YOU VERY MUCH
    leandroascierto.com Visual Basic 6 projects

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width