Page 3 of 3 FirstFirst 123
Results 81 to 111 of 111

Thread: Windows 10 Dark Mode & VB6 apps

  1. #81
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    I guess there are a few more (new) themes available since Mith posted the list on June 2023.

    For example for the TabStrip the following works properly. (TabStrip1.BackColor = vbBlack to conform to Form's BackColor)

    Code:
    SetWindowTheme TabStrip1.hWnd, 0, StrPtr("DarkMode_DarkTheme::Tab")
    Name:  DarkTab.png
Views: 227
Size:  1.4 KB

  2. #82
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    OptionButton with white text color. (NO Hooks needed !!)

    Code:
    SetWindowTheme OptionButtonW1.hWnd, StrPtr("DarkMode_DarkTheme"), 0
    Name:  DarkRadioButton.png
Views: 227
Size:  737 Bytes

    However, you should set the ForeColor of the OptionButtonW (or CheckBoxW) still to a white color so the focus rect is then visible on the dark theme.

    I "guess" finally they do the "proper" themes with "DarkMode_DarkTheme". So, "DarkTheme" is the way to go for win32 controls instead of "Explorer".
    Last edited by Krool; May 7th, 2026 at 01:36 PM.

  3. #83
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    Here a list of all the "_DarkTheme" names. I guess these should be preferred over the "_Explorer".

    Name:  DarkTheme.png
Views: 215
Size:  10.2 KB

    And yes, for example the Status bar (previously DarkMode::ExplorerStatusBar) did not theme the size grip. Now it is done properly. (DarkMode_DarkTheme::Status)

    Name:  DarkStatus.jpg
Views: 214
Size:  3.9 KB

    Probably will add a VisualTheme property to all VBCCR controls where you can set between 0 - Normal and 1 - Dark and it will take care everything.
    But some controls seems to be still missing. DatePicker and MonthView for example.
    Last edited by Krool; May 7th, 2026 at 02:41 PM.

  4. #84

  5. #85

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Krool View Post
    OptionButton with white text color. (NO Hooks needed !!)

    Code:
    SetWindowTheme OptionButtonW1.hWnd, StrPtr("DarkMode_DarkTheme"), 0
    Doenst work for me using Windows 10. I guess this is only supported with win11?

    edit: i tested my app with win11 and "DarkMode_DarkTheme" and i can confirm that this works with win11 (OptionButton /checkbox) but unfortunately not with any older windows version like win10!
    Last edited by Mith; May 7th, 2026 at 08:02 PM.

  6. #86

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    the background-color of the ImageCombo-control is not correct with "DarkMode_DarkTheme" (win11) because of the rounded corners:

    Name:  Screenshot - 08.05.2026 , 08_50_37.png
Views: 210
Size:  1.7 KB

    can we get a background-color property for this control?

    i guess an additional background-color property for the dropdown-list is not possible, or?

    Code:
    Call SetDarkMode_DarkTheme(icFolderIcon.hwnd)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndEdit)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndCombo)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndList)

  7. #87

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    i tried to fix the ImageCombo-background-color issue with this code, but it doesnt work.

    any ideas?

    Code:
    Call SetControlBackColor(icFolderIcon.hwnd, gDarkMode_BackColor)
    Call SetControlBackColor(icFolderIcon.hWndEdit, gDarkMode_BackColor)
    Call SetControlBackColor(icFolderIcon.hWndCombo, gDarkMode_BackColor)
    Call SetControlBackColor(icFolderIcon.hWndUserControl, gDarkMode_BackColor)
    Public Sub SetControlBackColor(ByRef hwnd As Long, ByVal New_Color As OLE_COLOR)
            'Const SB_SETBKCOLOR = &H2001
    10      OleTranslateColor New_Color, 0, New_Color
    20      SendMessageAny hwnd, SB_SETBKCOLOR, 0, ByVal New_Color
    End Sub

  8. #88

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    There is another display-issue when using the ListViewW-control with Windows11.

    Every column in Report Mode (.GridLines=false) has a light border at the right side:

    Name:  listviewW_darkmode_win11.png
Views: 203
Size:  4.7 KB

    This right-border is also shown when a column is hidden (.width=0):

    Name:  listviewW_darkmode_win11_hidden_column.png
Views: 206
Size:  1.0 KB

    This issue doesnt happen when using Win10.

    Does anyone know how to fix this?

    Code:
    Call SetDarkMode_DarkTheme(ListView.hwnd)
    Call SetDarkMode_DarkTheme(ListView.hwndHeader)
    Last edited by Mith; May 7th, 2026 at 11:11 PM.

  9. #89
    Lively Member
    Join Date
    Mar 2020
    Posts
    83

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Mith View Post
    Doenst work for me using Windows 10. I guess this is only supported with win11?

    edit: i tested my app with win11 and "DarkMode_DarkTheme" and i can confirm that this works with win11 (OptionButton /checkbox) but unfortunately not with any older windows version like win10!
    It doesn't work for me either with Windows 11 23H2

  10. #90

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Crapahute View Post
    It doesn't work for me either with Windows 11 23H2
    My test was with 25H2 (26200.7462).

  11. #91
    Member
    Join Date
    Feb 2023
    Posts
    55

    Re: Windows 10 Dark Mode & VB6 apps

    I do not get that working for richtextcontrols (krools VBCCR)
    None is working:
    SetWindowTheme c.hWnd, StrPtr("DarkMode_DarkTheme"), 0&
    SetWindowTheme c.hWndUserControl, StrPtr("DarkMode_DarkTheme"), 0&
    SetWindowTheme c.hWnd, StrPtr("DarkMode_Explorer"), 0&
    SetWindowTheme c.hWndUserControl, StrPtr("DarkMode_Explorer"), 0&

    Can anyone please post code for that. Thank you

  12. #92

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Chris_G33 View Post
    I do not get that working for richtextcontrols (krools VBCCR)
    Can anyone please post code for that. Thank you
    Code:
    Call SetDarkModeExplorer(RTB1.hwnd)
    RTB1.TextMode = 0 'Richtext
    
    {load or set text}
    
    With RTB1
    .SelStart = 0
    .SelLength = .textLength
    .SelColor = gDarkMode_FontColor
    .SelLength = 0
    End With

  13. #93
    Member
    Join Date
    Feb 2023
    Posts
    55

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Mith View Post
    Code:
    Call SetDarkModeExplorer(RTB1.hwnd)
    ...
    Thanks, but what does SetDarkModeExplorer(...) do? Code?

  14. #94
    Member
    Join Date
    Feb 2023
    Posts
    55

    Re: Windows 10 Dark Mode & VB6 apps

    Ah, I got it working:
    ScrollBars = vbBoth
    has to be set before SetWindowTheme

  15. #95
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Mith View Post
    the background-color of the ImageCombo-control is not correct with "DarkMode_DarkTheme" (win11) because of the rounded corners:

    Name:  Screenshot - 08.05.2026 , 08_50_37.png
Views: 210
Size:  1.7 KB

    can we get a background-color property for this control?

    i guess an additional background-color property for the dropdown-list is not possible, or?

    Code:
    Call SetDarkMode_DarkTheme(icFolderIcon.hwnd)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndEdit)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndCombo)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndList)
    Yes. Need to implement it. The edges are easy. The rest needs to involve some API hooks upon WM_DRAWITEM. It's on my list.

  16. #96
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Mith View Post
    the background-color of the ImageCombo-control is not correct with "DarkMode_DarkTheme" (win11) because of the rounded corners:

    Name:  Screenshot - 08.05.2026 , 08_50_37.png
Views: 210
Size:  1.7 KB

    can we get a background-color property for this control?

    i guess an additional background-color property for the dropdown-list is not possible, or?

    Code:
    Call SetDarkMode_DarkTheme(icFolderIcon.hwnd)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndEdit)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndCombo)
    Call SetDarkMode_DarkTheme(icFolderIcon.hWndList)
    ImageCombo has now BackColor/ForeColor property.

  17. #97

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Krool released OCX v1.8.105 with support for BackColor/ForeColor and .AllowImageHighlight for the ImageCombo!

    The update fixes the white corners (Win11) and the white background color of the DropDown list (win10) by using .BackColor!

    Bonus: .AllowImageHighlight=false prevents the icon from being displayed with a shadow layer after the user made a selection in the DropDown list.

    Dark Mode Win10:

    Name:  VBCCR1.8.105.imagecombo.win10.png
Views: 149
Size:  3.6 KB

    Dark Mode Win11:

    Name:  VBCCR1.8.105.imagecombo.win11.png.png
Views: 154
Size:  3.5 KB

  18. #98
    Lively Member
    Join Date
    Mar 2020
    Posts
    83

    Re: Windows 10 Dark Mode & VB6 apps

    I have improved my test program :
    TestDarkMode.zip

    I have some questions, in particular (commented lines don't work for me):

    Progressbar
    Code:
    Select Case TypeName(obj)
                
                Case "ProgressBar"
                    ' ???
    '                SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme::Progress")
    '                obj.BackColor = FRMBACKCOLOR
    '                obj.ForeColor = FRMFORECOLOR
    '                bFound = True
    TabStrip and CoolBar
    Code:
    Case "TabStrip"
                    'obj.VisualStyles = False
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme::Tab")
                    'SetWindowTheme obj.hwnd, StrPtr("DarkMode_Explorer"), 0&
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::ExplorerStatusBar") '<- ???
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer") '<- ???
                    obj.BackColor = FRMBACKCOLOR
                    bFound = True
                    
                Case "CoolBar"
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer") '<- ???
                    obj.BackColor = FRMBACKCOLOR
                    obj.ForeColor = FRMFORECOLOR
                    bFound = True
    Last edited by Crapahute; May 14th, 2026 at 09:43 AM.

  19. #99

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    afaik you only have to use StrPtr("DarkMode_DarkTheme") without ":: ...". does this help?

  20. #100
    Lively Member
    Join Date
    Mar 2020
    Posts
    83

    Re: Windows 10 Dark Mode & VB6 apps

    Yes it does for ProgressBar and Coolbar. Not for TabStrip.

    Code:
                Case "TabStrip"
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme")
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer") '<- ???
                    obj.BackColor = FRMBACKCOLOR
                    bFound = True
                    
                Case "CoolBar"
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme")
                    obj.BackColor = FRMBACKCOLOR
                    obj.ForeColor = FRMFORECOLOR
                    bFound = True
                
                Case "ProgressBar"
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme")
                    obj.BackColor = FRMBACKCOLOR
                    obj.ForeColor = FRMFORECOLOR
                    bFound = True

  21. #101

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Crapahute View Post
    Yes it does for ProgressBar and Coolbar. Not for TabStrip.
    Currently there is no dark mode support from MS for the TabStrip control ("SysTabControl32").

    More information if you want to dive deeper: https://community.notepad-plus-plus....herit-the-mode

  22. #102
    Lively Member
    Join Date
    Mar 2020
    Posts
    83

    Re: Windows 10 Dark Mode & VB6 apps

    Ok, then I stick with
    Code:
    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer")

  23. #103

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Crapahute View Post
    Ok, then I stick with
    Code:
    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer")
    Does this change any color at the TabStrip? I see no difference with Win10.

  24. #104
    Lively Member
    Join Date
    Mar 2020
    Posts
    83

    Re: Windows 10 Dark Mode & VB6 apps

    Here is what I get with my settings with Windows 11 (23H2)

    TabStrip is dark.

    Name:  testdarkmode01.jpg
Views: 129
Size:  64.2 KBName:  testdarkmode02.jpg
Views: 135
Size:  91.6 KB

    Code:
    Public Sub SetDarkMode(frm As Form, Optional bForceDarkMode As Boolean)
    '
    ' At the end of your Form_Load(), put SetDarkMode Me
    '
        If DarkMode = DRKMD_AUTO Then DarkMode = TestDarkMode
        If DarkMode = DRKMD_OFF And bForceDarkMode = False Then Exit Sub
    
        ' Title Bar
    Dim bValue As Long
       bValue = 1
       Call DwmSetWindowAttribute(frm.hwnd, DWMWA_USE_IMMERSIVE_DARK_MODE, bValue, LenB(bValue))
        
        ' Form colors
        frm.BackColor = FRMBACKCOLOR
        frm.ForeColor = FRMFORECOLOR
    
    Dim obj         As Object
    Dim i           As Long
    Dim idx         As Long
    Dim lbl         As Label
    Dim hCombo      As Long
    Dim hUpDown     As Long
    Dim pnl         As Object
    Dim bFound      As Boolean
    'Dim hTips As Long
    'Const LVM_FIRST = &H1000
    'Const LVM_GETTOOLTIPS = (LVM_FIRST + 78)
    
        For Each obj In frm.Controls
            
            bFound = False
            
            'ComboBox
            If (TypeOf obj Is VB.ComboBox) Then
                SetWindowTheme obj.hwnd, StrPtr("DarkMode_CFD"), 0&
                'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::Combobox")
                If obj.BackColor = vbWindowBackground Then obj.BackColor = FRMBACKCOLOR
                If obj.ForeColor = vbWindowText Then obj.ForeColor = FRMFORECOLOR
                bFound = True
            End If
            'Line
            If (TypeOf obj Is VB.Line) Then
                If obj.BorderColor = vbWindowText Then obj.BorderColor = WINDOWTEXTCOLOR
                bFound = True
            End If
            'Shape
            If (TypeOf obj Is VB.Shape) Then
                If obj.BorderColor = vbWindowText Then obj.BorderColor = WINDOWTEXTCOLOR
                If obj.FillColor = vbBlack Then obj.FillColor = vbWhite
                bFound = True
            End If
            'PictureBox
            If (TypeOf obj Is VB.PictureBox) Then
                If obj.BackColor = vbButtonFace Then obj.BackColor = FRMBACKCOLOR
                If obj.ForeColor = vbButtonText Then obj.ForeColor = FRMFORECOLOR
                If obj.Appearance = 0 Then
                    If obj.BackColor = vbWindowBackground Then obj.BackColor = FRMBACKCOLOR
                    If obj.ForeColor = vbWindowText Then obj.ForeColor = FRMFORECOLOR
                End If
                bFound = True
            End If
            
            '
            ' VBCCR ---------------------------------------------------------------------------------[
            '
            If bFound = False Then
                On Error Resume Next
                Select Case TypeName(obj)
                
                
                
                Case "ComboBoxW"
                    SetWindowTheme obj.hwnd, StrPtr("DarkMode_CFD"), 0&
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme::Combobox")
                    If obj.BackColor = vbWindowBackground Then obj.BackColor = FRMBACKCOLOR
                    If obj.ForeColor = vbWindowText Then obj.ForeColor = FRMFORECOLOR
                    bFound = True
                    
                Case "VirtualCombo"
                    SetWindowTheme obj.hwnd, StrPtr("DarkMode_CFD"), 0&
                    If obj.BackColor = vbWindowBackground Then obj.BackColor = FRMBACKCOLOR
                    If obj.ForeColor = vbWindowText Then obj.ForeColor = FRMFORECOLOR
                    bFound = True
                Case "FontCombo"
                    SetWindowTheme obj.hwnd, StrPtr("DarkMode_CFD"), 0&
                    If obj.BackColor = vbWindowBackground Then obj.BackColor = FRMBACKCOLOR
                    If obj.ForeColor = vbWindowText Then obj.ForeColor = FRMFORECOLOR
                    bFound = True
                    
                Case "ImageCombo"
                    obj.VisualStyles = False
                    'SetWindowTheme obj.hwnd, StrPtr("DarkMode_CFD"), 0&
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme::Combobox")
                    hCombo = FindWindowEx(obj.hwnd, 0, "ComboBox", vbNullString)
                    If hCombo <> 0 Then SetWindowTheme hCombo, StrPtr("DarkMode_CFD"), 0&
                    On Error Resume Next
                    obj.BackColor = FRMBACKCOLOR
                    obj.ForeColor = FRMFORECOLOR
                    On Error GoTo 0
                    bFound = True
                    
                Case "ListView"
                    SetWindowTheme obj.hwnd, StrPtr("DarkMode_Explorer"), 0&
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::ListView")
                    SetWindowTheme obj.hWndHeader, StrPtr("DarkMode_ItemsView"), 0&
                    For i = 1 To obj.ColumnHeaders.Count ' réglage des colonnes
                        obj.ColumnHeaders(i).ForeColor = CMDFORECOLOR
                    Next i
                    ' does not work for me or I'm missing something :
                    'hTips = SendMessage(obj.hWnd, LVM_GETTOOLTIPS, 0, ByVal 0)
                    'Call Win32SetWindowTheme(hTips, "DarkMode_Explorer")
                    If obj.BackColor = vbWindowBackground Then obj.BackColor = FRMBACKCOLOR
                    If obj.ForeColor = vbWindowText Then obj.ForeColor = FRMFORECOLOR
                    bFound = True
                    
                Case "ToolBar"
                    'SetWindowTheme obj.hwnd, StrPtr("DarkMode_Explorer"), 0&
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::Toolbar")
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme::Toolbar")
                    For i = 1 To obj.Buttons.Count
                        obj.Buttons(i).ForeColor = TLBFORECOLOR
                    Next i
                    If obj.BackColor = vbButtonFace Then obj.BackColor = FRMBACKCOLOR
                    If obj.InsertMarkColor = vbBlack Then obj.InsertMarkColor = vbWhite
                    bFound = True
                
                Case "DTPicker"
                    With obj
                    .VisualStyles = False
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer")
                    .CalendarBackColor = FRMBACKCOLOR
                    .CalendarForeColor = FRMFORECOLOR
                    .CalendarTitleBackColor = FRMBACKCOLOR
                    .CalendarTitleForeColor = FRMFORECOLOR
                    If .UpDown = True Then
                        hUpDown = FindWindowEx(obj.hwnd, 0&, "msctls_updown32", "")
                        If hUpDown <> 0 Then SetWindowTheme hUpDown, StrPtr("DarkMode_Explorer"), 0&
                    End If
                    End With
                    bFound = True
                    
                Case "MonthView"
                    With obj
                    '.VisualStyles = False
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer")
                    .BackColor = FRMBACKCOLOR
                    .ForeColor = FRMFORECOLOR
                    .TitleBackColor = FRMBACKCOLOR
                    .TitleForeColor = FRMFORECOLOR
                    End With
                    bFound = True
                    
                Case "RichTextBox"
                    'SetWindowTheme obj.hwnd, StrPtr("DarkMode_Explorer"), 0&
                    obj.BorderStyle = 0
                    obj.SelStart = 0
                    obj.SelLength = Len(obj.Text)
                    If obj.SelColor = vbBlack Then obj.SelColor = TXTFORECOLOR
                    If obj.BackColor = vbWindowBackground Then obj.BackColor = TXTBACKCOLOR
                     bFound = True
                     
                Case "StatusBar"
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::ExplorerStatusBar")
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme::Status")
                    For Each pnl In obj.Panels
                        pnl.ForeColor = TXTFORECOLOR
                    Next
                    bFound = True
                    
                Case "TabStrip"
                    'SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme")
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode::FileExplorerBannerContainer") '<- ???
                    obj.BackColor = FRMBACKCOLOR
                    bFound = True
                    
                Case "CoolBar"
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme")
                    obj.BackColor = FRMBACKCOLOR
                    obj.ForeColor = FRMFORECOLOR
                    bFound = True
                
                Case "ProgressBar"
                    SetWindowTheme obj.hwnd, 0&, StrPtr("DarkMode_DarkTheme")
                    obj.BackColor = FRMBACKCOLOR
                    obj.ForeColor = FRMFORECOLOR
                    bFound = True
                
                End Select
                On Error GoTo 0
            End If
            '----------------------------------------------------------------------------------------]
            
    
            If bFound = False Then
            
                '
                ' General case
                '
                On Error Resume Next
                SetWindowTheme obj.hwnd, StrPtr("DarkMode_Explorer"), 0&
                obj.BackColor = FRMBACKCOLOR
                obj.ForeColor = FRMFORECOLOR
                On Error GoTo 0
            
                '
                ' Special cases
                '
                Select Case TypeName(obj)
                
                Case "CommandButton"
                    obj.BackColor = CMDBACKCOLOR
                    bFound = True
                
                Case "TextBox"
                    obj.BackColor = TXTBACKCOLOR
                    obj.ForeColor = TXTFORECOLOR
                    obj.Appearance = 0
                    obj.BorderStyle = 0
                    bFound = True
                '
                ' VBCCR --------------------------------------------[
                '
                Case "CommandButtonW"
                    obj.BackColor = CMDBACKCOLOR
                    obj.ForeColor = CMDFORECOLOR
                    bFound = True
                    
                Case "TextBoxW"
                    obj.BackColor = TXTBACKCOLOR
                    obj.ForeColor = TXTFORECOLOR
                    obj.BorderStyle = 0
                    bFound = True
                '---------------------------------------------------]
                End Select
                
            End If
        Next
        '
        'Option, Check,  Frame, VBFlexGrid
        '
        If bFound = False Then
            idx = 0
            For Each obj In frm.Controls
                
                Select Case TypeName(obj)
                
                Case "OptionButton"
                    If Not addLabelOption(frm, obj) Then addLabel frm, obj
                    
                Case "CheckBox"
                    If Not addLabelOption(frm, obj) Then addLabel frm, obj
                
                Case "Frame"
                    darkFrame frm, obj
                
                Case "OptionButtonW" ' VBCCR
                    On Error Resume Next
                    If obj.DrawMode <> 1 Then ' If DrawMode is not set to OptDrawModeOwnerDraw
                        If Not addLabelOptionW(frm, obj) Then addLabel frm, obj
                    End If
                    On Error GoTo 0
                    
                Case "CheckBoxW" ' VBCCR
                    On Error Resume Next
                    If obj.DrawMode <> 1 Then ' If DrawMode is not set to ChkDrawModeOwnerDraw
                        If Not addLabelOptionW(frm, obj) Then addLabel frm, obj
                    End If
                    On Error GoTo 0
                    
                Case "VBFlexGrid" ' VBFlexGrid
                    On Error Resume Next
                    obj.GridColor = VBFLXGRD_GRIDCOLOR
                    obj.BackColorFixed = TXTBACKCOLOR
                    On Error GoTo 0
                
                End Select
                
            Next
        End If
        
    End Sub
    Last edited by Crapahute; May 15th, 2026 at 03:19 AM.

  25. #105
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Krool View Post
    I guess there are a few more (new) themes available since Mith posted the list on June 2023.

    For example for the TabStrip the following works properly. (TabStrip1.BackColor = vbBlack to conform to Form's BackColor)

    Code:
    SetWindowTheme TabStrip1.hWnd, 0, StrPtr("DarkMode_DarkTheme::Tab")
    Name:  DarkTab.png
Views: 227
Size:  1.4 KB
    Mith, for me TabStrip works in DarkMode.

  26. #106

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Krool View Post
    Mith, for me TabStrip works in DarkMode.
    Windows 10?

  27. #107
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Mith View Post
    Windows 10?
    Forget Windows 10.
    DarkMode_DarkTheme is the right attempt by MS to address win32 applications. Not yet 100% but.. hopefully someday. Like date picker and calendar still missing.
    Everything else is not right by design. Therefore I would make a OS version check and enable dark mode only when that is met. Finish.

  28. #108

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by Krool View Post
    Forget Windows 10.
    DarkMode_DarkTheme is the right attempt by MS to address win32 applications. Not yet 100% but.. hopefully someday. Like date picker and calendar still missing.
    Everything else is not right by design. Therefore I would make a OS version check and enable dark mode only when that is met. Finish.
    DarkMode_DarkTheme works only with Win11 and not with Win10!

    My app supports Dark Mode for Windows 10 & 11 thats the reason i check the OS version and use different API-calls to get the correct control colors.
    The Win10 dark mode is not perfect but it is still possible.

  29. #109

  30. #110

    Thread Starter
    Fanatic Member Mith's Avatar
    Join Date
    Jul 2017
    Location
    Thailand
    Posts
    540

    Re: Windows 10 Dark Mode & VB6 apps

    Quote Originally Posted by wqweto View Post
    > The Win10 dark mode is not perfect but it is still possible.

    And it works on Win11
    Only partially, for example:

    1. you dont have to ownerdraw the checkbox/optionbutton anymore when using the new "DarkMode_DarkTheme" with win11!
    2. the up/down buttons inside a textbox/DatePicker dont have the dark mode style & colors with win10 but with win11 and "DarkMode_DarkTheme" it works.
    3. no dark mode when using the TabStrip under win10. you have to use "DarkMode_DarkTheme" with win11.
    Last edited by Mith; May 15th, 2026 at 08:29 PM.

  31. #111
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,728

    Re: Windows 10 Dark Mode & VB6 apps

    Just for information. The VBFlexGrid works now better in "dark mode colors".

    As you can see below the focus rect. Top is now after an update and bottom how it was before or is in a MSFlexGrid.

    Name:  FlexDrawFocusRect_SetBkColor.png
Views: 47
Size:  565 Bytes

    Reason is that the DrawFocusRect API makes an XOR operation. And there SetBkColor/SetTextColor influences the outcome.
    SetTextColor is of course used but not SetBkColor. It remained still in the default color of white. Now it's set to what the background actually is.

Page 3 of 3 FirstFirst 123

Tags for this Thread

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