Jump to content

Recommended Posts

Posted

My scenario that I am referring to is when the UpDown controls are active because the tabs are overflowing like in the example below.

Let's assume that you use the UpDown buttons to go all the way to the far right buttons and "tab0" is no longer showing within the tab control.

How can I determine that "tab0" cannot be seen within the tab control?

Thank you. :)

 

Example:

#include <GUIConstantsEx.au3>

Example()

Func Example()
    GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateTabItem("tab2")
    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateTabItem("tab5")
    GUICtrlCreateTabItem("tab6")

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

 

Posted

my mod:

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateTabItem("tab2")
    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateTabItem("tab5")
    Local $iTab6 = GUICtrlCreateTabItem("tab6")

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUISetState(@SW_SHOW)

    GUISwitch($hGUI, $iTab6)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

and please take a look here:

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

I think that I've got exactly what I need to work with now. I'm not using AdlibRegister in GUIDarkTheme UDF, but just for the sake of this example:

#include <GUIConstantsEx.au3>
#include <GuiTab.au3>

Global $idTab

Example()

Func Example()
    GUICreate("My GUI Tab", 320, 300) ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x202020)
    GUISetFont(10, 300)

    $idTab = GUICtrlCreateTab(10, 10, 300, 280)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateTabItem("tab2")
    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateTabItem("tab5")
    GUICtrlCreateTabItem("tab6")

    GUICtrlCreateTabItem("") ; end tabitem definition

    AdlibRegister("MyAdLibFunc", 1000)
    GUISetState(@SW_SHOW)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()
        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    AdlibUnRegister("MyAdLibFunc")
EndFunc   ;==>Example

Func MyAdLibFunc()
    ConsoleWrite("tab on left: " & _GUICtrlTab_HitTest($idTab, 10, 10)[0] & @CRLF)
EndFunc   ;==>MyAdLibFunc

 

 

Posted

Maybe this way:

#include <GUIConstantsEx.au3>
    #include <GuiTab.au3>

    Example()

    Func Example()
        GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

        GUISetBkColor(0x00E0FFFF)
        GUISetFont(9, 300)

        Local $iTab_main = GUICtrlCreateTab(10, 10, 200, 100)

        GUICtrlCreateTabItem("tab0")
        GUICtrlCreateTabItem("tab1")
        GUICtrlCreateTabItem("tab2")
        GUICtrlCreateTabItem("tab3")
        GUICtrlCreateTabItem("tab4")
        GUICtrlCreateTabItem("tab5")
        GUICtrlCreateTabItem("tab6")

        GUICtrlCreateTabItem("") ; end tabitem definition

        GUISetState(@SW_SHOW)

        ; activate tab - Show them
        _GUICtrlTab_ActivateTab($iTab_main, 6)
        MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, 1)
        Local $tRECT = _GUICtrlTab_GetItemRectEx($iTab_main, 0)
        ConsoleWrite($tRECT.left & @CRLF)
        ConsoleWrite($tRECT.right & @CRLF)
        ConsoleWrite($tRECT.top & @CRLF)
        ConsoleWrite($tRECT.bottom & @CRLF)

        Local $idMsg
        ; Loop until the user exits.
        While 1
            $idMsg = GUIGetMsg()

            If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
        WEnd
    EndFunc   ;==>Example

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

better example:

#include <GUIConstantsEx.au3>
#include <GuiTab.au3>

Example()

Func Example()
    GUICreate("My GUI Tab")     ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    Local $iTab_main = GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateTabItem("tab2")
    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateTabItem("tab5")
    GUICtrlCreateTabItem("tab6")

    GUICtrlCreateTabItem("")     ; end tabitem definition

    GUISetState(@SW_SHOW)


    _Testing($iTab_main)

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

Func _Testing($iTab_main)
    Local $t
    For $IDX = 0 To 6
        ; activate tab - Show them
        _GUICtrlTab_ActivateTab($iTab_main, $IDX)
        Local $tRECT = _GUICtrlTab_GetItemRectEx($iTab_main, 0)
        ConsoleWrite(@CRLF & "> Tab" & $IDX & " is now active" & @CRLF)
        ConsoleWrite("l=" & $tRECT.left & @CRLF)
        $t = (($tRECT.right < 0) ? ("! INVISIBLE ") : (""))
        ConsoleWrite($t & "r=" & $tRECT.right & @CRLF)
        ConsoleWrite("t=" & $tRECT.top & @CRLF)
        ConsoleWrite("b=" & $tRECT.bottom & @CRLF)
        If $t Then MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, "check INVISIBLE")
    Next
EndFunc   ;==>_Testing

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted
5 minutes ago, mLipok said:

Maybe this way:

In this situation, I don't want to activate a tab. It has more to do with when the user is resizing the GUI and only when the UpDown controls are visible. It has to do with getting the right measurements for drawing the line color on top of the selected tab. The weird thing is Windows does something visually wrong when the tab on the left is not 0 (first tab of all tabs). So I had to correct for it. I will show example soon because I think I got it right.

Posted

You can see my corrections to the line painting rect here:

Local $bTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $i <> 0 Then $iRight = $tRect.Right - 2
If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $bTabOnLeft <> 0 Then $iRight = $tRect.Right

For example, if you run the example and select Tab2. Then resize the GUI so that the UpDown controls appear and disappear. You will notice that visually the selected tab (Tab2) appears to shrink and grow by 2 pixels. But this seems a visual bug on Windows because the actual RECT does not change at all. So I have to adjust my code to account for the 2 pixel difference depending on whether Tab0 is on left.

But now that I have it fixed, you will see that my blue line on top of selected tab now adjusts size to be correct when resizing the GUI or cycling through the tabs.

Actually there seems to be some incorrect measurements when cycling through tabs. Resizing GUI is corrected proper. But problem still when cycling through tabs. Ughhh... Microsoft.

Working example below needs to run on 24H2/25H2 because of theme.

; From Nine
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>
#include <WindowsSysColorConstants.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Opt("MustDeclareVars", True)

Global $g_hPenAccent = _WinAPI_CreatePen($PS_SOLID, 2, _ColorToCOLORREF(0x0078D4))

Example()

Func Example()
    Local $hGUI = GUICreate("DarkTheme TabControl", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))

    GUISetBkColor(0x191919)
    GUISetFont(10, 300)

    Local $idTab = GUICtrlCreateTab(20, 20, 360, 260)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
    Local $hTab = GUICtrlGetHandle($idTab)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateLabel("label1", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW)
    GUICtrlCreateLabel("Resize GUI to trigger UpDown controls.", 30, 80, 300, 100)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateLabel("label3", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateLabel("label4", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("") ; end tabitem definition

    ; set DarkMode_DarkTheme visual theme on Tab control as long as OSBuild supports it
    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hTab, 'DarkMode_DarkTheme')

    ; get handle for UpDown control to apply theme
    Local $hUpDown = _WinAPI_FindWindowEx($hTab, "msctls_updown32")
    If _is24H2Plus() And $hUpDown Then _WinAPI_SetWindowTheme($hUpDown, 'DarkMode_DarkTheme')

    Local $pAddress = _WinAPI_GetWindowLong($hTab, $GWL_WNDPROC)
    Local $hSubclass = DllCallbackRegister(_ModernTabProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")
    _WinAPI_SetWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab, $pAddress)

    ; remove focus rectangle from tab control
    GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0)

    ; lower the Z-order of the tab control (helps fix various issues)
    _WinAPI_SetWindowPos($hTab, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOREDRAW, $SWP_NOSIZE))

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_RemoveWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab)
    DllCallbackFree($hSubclass)
EndFunc   ;==>Example

Func _ModernTabProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData)
    Switch $iMsg
        Case $WM_ERASEBKGND
            Return 1 ; Prevent background erase to avoid flicker

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint)
            Local $tRect2 = _WinAPI_GetClientRect($hWnd)
            Local $iW = $tRect2.Right
            Local $iH = $tRect2.Bottom

            Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap)

            Local $iUpDownWidth = 0

            Local Const $PRF_CHILDREN = 16
            Local Const $PRF_CLIENT = 4

            _SendMessage($hWnd, $WM_PRINTCLIENT, $hMemDC, BitOr($PRF_CLIENT, $PRF_CHILDREN))

            Local $hBrush = _WinAPI_CreateSolidBrush(0x191919)
            Local $iTabCount = _GUICtrlTab_GetItemCount($hWnd)
            
            If $iTabCount > 0 Then
                ; determine if tab control contains an UpDown (spin) control
                Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32")
                If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                    Local $tCR = _WinAPI_GetWindowRect($hTabUpDown)
                    Local $tPR = _WinAPI_GetWindowRect($hWnd)

                    ; get width of UpDown control
                    $iUpDownWidth = $tCR.Right - $tCR.Left

                    ; exclude UpDown control from being painted over
                    DllCall('gdi32.dll', "int", "ExcludeClipRect", "handle", $hDC, "int", $tCR.Left - $tPR.Left, "int", _
                            $tCR.Top - $tPR.Top - 1, "int", $tCR.Right - $tPR.Left, "int", $tCR.Bottom - $tPR.Top + 2)
                EndIf

                ; Draw selection indicator (top border for selected tab)
                Local $tRect, $iLeft, $iTop, $iRight, $iBottom
                Local $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0)
                Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0)
                For $i = 0 To $iTabCount - 1
                    Local $bSelected = ($i = $iCurSel)
                    If $bSelected Then
                        ; Get tab rectangle using TCM_GETITEMRECT
                        $tRect = DllStructCreate($tagRECT)
                        Local $aResult = DllCall('user32.dll', "lresult", "SendMessageW", _
                                "hwnd", $hWnd, _
                                "uint", $TCM_GETITEMRECT, _
                                "wparam", $i, _
                                "struct*", $tRect)
                        If @error Or Not $aResult[0] Then ContinueLoop

                        $iLeft = $tRect.Left
                        $iTop = $tRect.Top
                        $iRight = $tRect.Right
                        $iBottom = $tRect.Bottom

                        ;If _GUICtrlTab_HitTest($hWnd, 10, 10)[0] <> 0 Then ConsoleWrite("tab on left is not 0" & @CRLF)
                        ;ConsoleWrite("tab on left: " & _GUICtrlTab_HitTest($hWnd, 10, 10)[0] & @CRLF)
                        ; adjustment for UpDown
                        Local $bTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                        If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $i <> 0 Then $iRight = $tRect.Right - 2
                        If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $bTabOnLeft <> 0 Then $iRight = $tRect.Right

                        ; Skip if rectangle is invalid
                        If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop
                        Local $hPen = $g_hPenAccent
                        Local $hOldPen = _WinAPI_SelectObject($hMemDC, $hPen)
                        _WinAPI_MoveTo($hMemDC, $iLeft - 1, $iTop - 1)
                        _WinAPI_LineTo($hMemDC, $iRight, $iTop - 2)
                        _WinAPI_SelectObject($hMemDC, $hOldPen)
                    EndIf

                    _WinAPI_SelectObject($hMemDC, $hBrush)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.right - 1 - $iUpDownWidth, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.left + 1, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                Next

                _WinAPI_DeleteObject($hBrush)
                _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY)

                _WinAPI_SelectObject($hMemDC, $hOldBmp)
                _WinAPI_DeleteObject($hBitmap)
                _WinAPI_DeleteDC($hMemDC)
                _WinAPI_EndPaint($hWnd, $tPaint)
            EndIf

            Return 0
        Case $WM_PARENTNOTIFY
            ; Fired when a child window is created inside the tab control.
            ; The tab spinner (msctls_updown32) is created lazily by Windows when tabs overflow -
            ; it doesn't exist at init time, so we theme it here the moment it appears.
            If _WinAPI_LoWord($wParam) = $WM_CREATE Then
                Local $hNewChild = HWnd($lParam) ; lParam carries the new child's HWND as integer - must cast!
                If _WinAPI_GetClassName($hNewChild) = "msctls_updown32" Then
                    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hNewChild, 'DarkMode_DarkTheme')
                EndIf
            EndIf
            Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    EndSwitch

    Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_ModernTabProc

Func _is24H2Plus()
    ; check if this OS build is Windows 11 24H2/25H2 to support the newer DarkMode_DarkTheme
    Local $iRevision = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR")
    Local $b24H2Plus = False
    If @OSBuild >= 26100 And $iRevision >= 6899 Then
        $b24H2Plus = True
    Else
        ConsoleWrite("Windows 11 24H2/25H2 (build 26100.6899 or higher) is required to use DarkMode_DarkTheme.")
    EndIf
    Return $b24H2Plus
EndFunc

Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0)
    Local $ret = DllCall('user32.dll', "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    Return DllCall('comctl32.dll', 'lresult', 'DefSubclassProc', 'hwnd', $hWnd, 'uint', $iMsg, 'wparam', $wParam, _
            'lparam', $lParam)[0]
EndFunc   ;==>__WinAPI_DefSubclassProc

Func _ColorToCOLORREF($iColor) ;RGB to BGR
    Local $iR = BitAND(BitShift($iColor, 16), 0xFF)
    Local $iG = BitAND(BitShift($iColor, 8), 0xFF)
    Local $iB = BitAND($iColor, 0xFF)
    Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR)
EndFunc   ;==>_ColorToCOLORREF

 

Posted

I think I finally have it now:

If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
    Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
    If $iTabOnLeft <> 0 Then $iRight = $tRect.Right
    If $iTabOnLeft = 0 And $iCurSel <> 0 Then $iRight = $tRect.Right - 2
EndIf
; From Nine
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>
#include <WindowsSysColorConstants.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Opt("MustDeclareVars", True)

Global $g_hPenAccent = _WinAPI_CreatePen($PS_SOLID, 2, _ColorToCOLORREF(0x0078D4))

Example()

Func Example()
    Local $hGUI = GUICreate("DarkTheme TabControl", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))

    GUISetBkColor(0x191919)
    GUISetFont(10, 300)

    Local $idTab = GUICtrlCreateTab(20, 20, 360, 260)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
    Local $hTab = GUICtrlGetHandle($idTab)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateLabel("label1", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW)
    GUICtrlCreateLabel("Resize GUI to trigger UpDown controls.", 30, 80, 300, 100)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateLabel("label3", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateLabel("label4", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("") ; end tabitem definition

    ; set DarkMode_DarkTheme visual theme on Tab control as long as OSBuild supports it
    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hTab, 'DarkMode_DarkTheme')

    ; get handle for UpDown control to apply theme
    Local $hUpDown = _WinAPI_FindWindowEx($hTab, "msctls_updown32")
    If _is24H2Plus() And $hUpDown Then _WinAPI_SetWindowTheme($hUpDown, 'DarkMode_DarkTheme')

    Local $pAddress = _WinAPI_GetWindowLong($hTab, $GWL_WNDPROC)
    Local $hSubclass = DllCallbackRegister(_ModernTabProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")
    _WinAPI_SetWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab, $pAddress)

    ; remove focus rectangle from tab control
    GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0)

    ; lower the Z-order of the tab control (helps fix various issues)
    _WinAPI_SetWindowPos($hTab, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOREDRAW, $SWP_NOSIZE))

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_RemoveWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab)
    DllCallbackFree($hSubclass)
EndFunc   ;==>Example

Func _ModernTabProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData)
    Switch $iMsg
        Case $WM_ERASEBKGND
            Return 1 ; Prevent background erase to avoid flicker

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint)
            Local $tRect2 = _WinAPI_GetClientRect($hWnd)
            Local $iW = $tRect2.Right
            Local $iH = $tRect2.Bottom

            Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap)

            Local $iUpDownWidth = 0

            Local Const $PRF_CHILDREN = 16
            Local Const $PRF_CLIENT = 4

            _SendMessage($hWnd, $WM_PRINTCLIENT, $hMemDC, BitOr($PRF_CLIENT, $PRF_CHILDREN))

            Local $hBrush = _WinAPI_CreateSolidBrush(0x191919)
            Local $iTabCount = _GUICtrlTab_GetItemCount($hWnd)
            
            If $iTabCount > 0 Then
                ; determine if tab control contains an UpDown (spin) control
                Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32")
                If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                    Local $tCR = _WinAPI_GetWindowRect($hTabUpDown)
                    Local $tPR = _WinAPI_GetWindowRect($hWnd)

                    ; get width of UpDown control
                    $iUpDownWidth = $tCR.Right - $tCR.Left

                    ; exclude UpDown control from being painted over
                    DllCall('gdi32.dll', "int", "ExcludeClipRect", "handle", $hDC, "int", $tCR.Left - $tPR.Left, "int", _
                            $tCR.Top - $tPR.Top - 1, "int", $tCR.Right - $tPR.Left, "int", $tCR.Bottom - $tPR.Top + 2)
                EndIf

                ; Draw selection indicator (top border for selected tab)
                Local $tRect, $iLeft, $iTop, $iRight, $iBottom
                Local $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0)
                Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0)
                For $i = 0 To $iTabCount - 1
                    Local $bSelected = ($i = $iCurSel)
                    If $bSelected Then
                        ; Get tab rectangle using TCM_GETITEMRECT
                        $tRect = DllStructCreate($tagRECT)
                        Local $aResult = DllCall('user32.dll', "lresult", "SendMessageW", _
                                "hwnd", $hWnd, _
                                "uint", $TCM_GETITEMRECT, _
                                "wparam", $i, _
                                "struct*", $tRect)
                        If @error Or Not $aResult[0] Then ContinueLoop

                        $iLeft = $tRect.Left
                        $iTop = $tRect.Top
                        $iRight = $tRect.Right
                        $iBottom = $tRect.Bottom

                        ;If _GUICtrlTab_HitTest($hWnd, 10, 10)[0] <> 0 Then ConsoleWrite("tab on left is not 0" & @CRLF)
                        ;ConsoleWrite("tab on left: " & _GUICtrlTab_HitTest($hWnd, 10, 10)[0] & @CRLF)
                        ; adjustment for UpDown
                        ;Local $bTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                        If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                            Local $bTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                            If $bTabOnLeft <> 0 Then $iRight = $tRect.Right
                            If $bTabOnLeft = 0 And $iCurSel <> 0 Then $iRight = $tRect.Right - 2
                        EndIf
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $i <> 0 Then $iRight = $tRect.Right - 2
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $bTabOnLeft <> 0 Then $iRight = $tRect.Right

                        ; Skip if rectangle is invalid
                        If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop
                        Local $hPen = $g_hPenAccent
                        Local $hOldPen = _WinAPI_SelectObject($hMemDC, $hPen)
                        _WinAPI_MoveTo($hMemDC, $iLeft - 1, $iTop - 1)
                        _WinAPI_LineTo($hMemDC, $iRight, $iTop - 2)
                        _WinAPI_SelectObject($hMemDC, $hOldPen)
                    EndIf

                    _WinAPI_SelectObject($hMemDC, $hBrush)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.right - 1 - $iUpDownWidth, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.left + 1, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                Next

                _WinAPI_DeleteObject($hBrush)
                _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY)

                _WinAPI_SelectObject($hMemDC, $hOldBmp)
                _WinAPI_DeleteObject($hBitmap)
                _WinAPI_DeleteDC($hMemDC)
                _WinAPI_EndPaint($hWnd, $tPaint)
            EndIf

            Return 0
        Case $WM_PARENTNOTIFY
            ; Fired when a child window is created inside the tab control.
            ; The tab spinner (msctls_updown32) is created lazily by Windows when tabs overflow -
            ; it doesn't exist at init time, so we theme it here the moment it appears.
            If _WinAPI_LoWord($wParam) = $WM_CREATE Then
                Local $hNewChild = HWnd($lParam) ; lParam carries the new child's HWND as integer - must cast!
                If _WinAPI_GetClassName($hNewChild) = "msctls_updown32" Then
                    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hNewChild, 'DarkMode_DarkTheme')
                EndIf
            EndIf
            Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    EndSwitch

    Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_ModernTabProc

Func _is24H2Plus()
    ; check if this OS build is Windows 11 24H2/25H2 to support the newer DarkMode_DarkTheme
    Local $iRevision = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR")
    Local $b24H2Plus = False
    If @OSBuild >= 26100 And $iRevision >= 6899 Then
        $b24H2Plus = True
    Else
        ConsoleWrite("Windows 11 24H2/25H2 (build 26100.6899 or higher) is required to use DarkMode_DarkTheme.")
    EndIf
    Return $b24H2Plus
EndFunc

Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0)
    Local $ret = DllCall('user32.dll', "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    Return DllCall('comctl32.dll', 'lresult', 'DefSubclassProc', 'hwnd', $hWnd, 'uint', $iMsg, 'wparam', $wParam, _
            'lparam', $lParam)[0]
EndFunc   ;==>__WinAPI_DefSubclassProc

Func _ColorToCOLORREF($iColor) ;RGB to BGR
    Local $iR = BitAND(BitShift($iColor, 16), 0xFF)
    Local $iG = BitAND(BitShift($iColor, 8), 0xFF)
    Local $iB = BitAND($iColor, 0xFF)
    Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR)
EndFunc   ;==>_ColorToCOLORREF

 

Posted

finally ???

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <GuiTab.au3>

Global $hGUI
Example()

Func Example()
    $hGUI = GUICreate("My GUI Tab")     ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    Local $iTab_main = GUICtrlCreateTab(10, 10, 200, 100)

    For $IDX = 0 To 10
        GUICtrlCreateTabItem("tab" & $IDX)
    Next

    GUICtrlCreateTabItem("")     ; end tabitem definition

    GUISetState(@SW_SHOW)

    _Testing($iTab_main, 10)

    _GUICtrlTab_ActivateTab($iTab_main, 10)
    _Testing($iTab_main, 0)


    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example

Func _Testing($iTab_main, $IDX)
    Local $aPos = ControlGetPos($hGUI, "", "[CLASS:msctls_updown32; INSTANCE:1]")
    Local $x = $aPos[0]
    Local $tRECT = _GUICtrlTab_GetItemRectEx($iTab_main, $IDX)
    ConsoleWrite("l=" & $tRECT.left & @CRLF)
    ConsoleWrite("r=" & $tRECT.right & @CRLF)
    ConsoleWrite("t=" & $tRECT.top & @CRLF)
    ConsoleWrite("b=" & $tRECT.bottom & @CRLF)

    If $tRECT.right < 0 Or $tRECT.left > $x Then MsgBox($MB_TOPMOST, "TEST #" & @ScriptLineNumber, "tab" & $IDX & " is INVISIBLE")

    Local $aHit = _GUICtrlTab_HitTest($iTab_main, $tRECT.left, $tRECT.top)
    ConsoleWrite("> " & _ArrayToString($aHit) & @CRLF)
EndFunc   ;==>_Testing

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted
1 minute ago, mLipok said:

finally ???

This is fantastic. Nice work! I like this technique. :thumbsup:

On a side note, I was wrong. My fix did not end up working afterall. I am really close to giving up on that beautiful blue line. Microsoft is doing something weird on this since the Rect size is not changing, despite visually seeing it change with our own eyes.

Posted

Apparently $TCS_FIXEDWIDTH does not even help with Microsoft's visual trick. Since the Rect size is not changing no matter what, it is simply some sort of visual painting trick that they seem to be doing.

It's working right something like 90% of the time now which is better than before. But 90% does not cut it for me. I may have to step away on this issue for a few hours because I'm going to lose my mind. 🙃

Posted

I'll leave what I have so far. It works great like 90% of the time. I think that the only time where the blue line gets painted wrong by 1-2 pixels is when the GUI is resized very small horizontally and then change tabs. But otherwise it is pretty good and makes corrections for Microsoft's silliness.

; From Nine
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>
#include <WindowsSysColorConstants.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Opt("MustDeclareVars", True)

Global $g_hPenAccent = _WinAPI_CreatePen($PS_SOLID, 2, _ColorToCOLORREF(0x0078D4))

Example()

Func Example()
    Local $hGUI = GUICreate("DarkTheme TabControl", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))

    GUISetBkColor(0x191919)
    GUISetFont(10, 300)

    Local $idTab = GUICtrlCreateTab(20, 20, 360, 260)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
    Local $hTab = GUICtrlGetHandle($idTab)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateLabel("label1", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW)
    GUICtrlCreateLabel("Resize GUI to trigger UpDown controls.", 30, 80, 300, 100)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateLabel("label3", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateLabel("label4", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP)

    GUICtrlCreateTabItem("") ; end tabitem definition

    ; set DarkMode_DarkTheme visual theme on Tab control as long as OSBuild supports it
    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hTab, 'DarkMode_DarkTheme')

    ; get handle for UpDown control to apply theme
    Local $hUpDown = _WinAPI_FindWindowEx($hTab, "msctls_updown32")
    If _is24H2Plus() And $hUpDown Then _WinAPI_SetWindowTheme($hUpDown, 'DarkMode_DarkTheme')

    Local $pAddress = _WinAPI_GetWindowLong($hTab, $GWL_WNDPROC)
    Local $hSubclass = DllCallbackRegister(_ModernTabProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")
    _WinAPI_SetWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab, $pAddress)

    ; remove focus rectangle from tab control
    GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0)

    ; lower the Z-order of the tab control (helps fix various issues)
    _WinAPI_SetWindowPos($hTab, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOREDRAW, $SWP_NOSIZE))

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_RemoveWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab)
    DllCallbackFree($hSubclass)
EndFunc   ;==>Example

Func _ModernTabProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData)
    Switch $iMsg
        Case $WM_ERASEBKGND
            Return 1 ; Prevent background erase to avoid flicker

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint)
            Local $tRect2 = _WinAPI_GetClientRect($hWnd)
            Local $iW = $tRect2.Right
            Local $iH = $tRect2.Bottom

            Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap)

            Local $iUpDownWidth = 0

            Local Const $PRF_CHILDREN = 16
            Local Const $PRF_CLIENT = 4

            _SendMessage($hWnd, $WM_PRINTCLIENT, $hMemDC, BitOr($PRF_CLIENT, $PRF_CHILDREN))

            Local $hBrush = _WinAPI_CreateSolidBrush(0x191919)
            Local $iTabCount = _GUICtrlTab_GetItemCount($hWnd)
            
            If $iTabCount > 0 Then
                ; determine if tab control contains an UpDown (spin) control
                Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32")
                If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                    Local $tCR = _WinAPI_GetWindowRect($hTabUpDown)
                    Local $tPR = _WinAPI_GetWindowRect($hWnd)

                    ; get width of UpDown control
                    $iUpDownWidth = $tCR.Right - $tCR.Left

                    ; exclude UpDown control from being painted over
                    DllCall('gdi32.dll', "int", "ExcludeClipRect", "handle", $hDC, "int", $tCR.Left - $tPR.Left, "int", _
                            $tCR.Top - $tPR.Top - 1, "int", $tCR.Right - $tPR.Left, "int", $tCR.Bottom - $tPR.Top + 2)
                EndIf

                ; Draw selection indicator (top border for selected tab)
                Local $tRect, $iLeft, $iTop, $iRight, $iBottom
                Local $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0)
                Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0)
                For $i = 0 To $iTabCount - 1
                    Local $bSelected = ($i = $iCurSel)
                    If $bSelected Then
                        ; Get tab rectangle using TCM_GETITEMRECT
                        $tRect = DllStructCreate($tagRECT)
                        Local $aResult = DllCall('user32.dll', "lresult", "SendMessageW", _
                                "hwnd", $hWnd, _
                                "uint", $TCM_GETITEMRECT, _
                                "wparam", $i, _
                                "struct*", $tRect)
                        If @error Or Not $aResult[0] Then ContinueLoop

                        $iLeft = $tRect.Left
                        $iTop = $tRect.Top
                        $iRight = $tRect.Right
                        $iBottom = $tRect.Bottom

                        ;If _GUICtrlTab_HitTest($hWnd, 10, 10)[0] <> 0 Then ConsoleWrite("tab on left is not 0" & @CRLF)
                        ;ConsoleWrite("tab on left: " & _GUICtrlTab_HitTest($hWnd, 10, 10)[0] & @CRLF)
                        ; adjustment for UpDown
                        ;Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                        If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                            Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                            If $iTabOnLeft <> 0 Then $iRight = $tRect.Right
                            If $iTabOnLeft = 0 And $iCurSel <> 0 Then $iRight = $tRect.Right - 2
                            ; if tab on left <> selected tab...
                        EndIf
                        ConsoleWrite("$tRect.Left: " & $tRect.Left & @CRLF)
                        ConsoleWrite("$tRect.Top: " & $tRect.Top & @CRLF)
                        ConsoleWrite("$tRect.Right: " & $tRect.Right & @CRLF)
                        ConsoleWrite("$tRect.Bottom: " & $tRect.Bottom & @CRLF)
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $i <> 0 Then $iRight = $tRect.Right - 2
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $iTabOnLeft <> 0 Then $iRight = $tRect.Right

                        ; Skip if rectangle is invalid
                        If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop
                        Local $hPen = $g_hPenAccent
                        Local $hOldPen = _WinAPI_SelectObject($hMemDC, $hPen)
                        _WinAPI_MoveTo($hMemDC, $iLeft - 1, $iTop - 1)
                        _WinAPI_LineTo($hMemDC, $iRight, $iTop - 2)
                        _WinAPI_SelectObject($hMemDC, $hOldPen)
                    EndIf

                    _WinAPI_SelectObject($hMemDC, $hBrush)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.right - 1 - $iUpDownWidth, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.left + 1, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                Next

                _WinAPI_DeleteObject($hBrush)
                _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY)

                _WinAPI_SelectObject($hMemDC, $hOldBmp)
                _WinAPI_DeleteObject($hBitmap)
                _WinAPI_DeleteDC($hMemDC)
                _WinAPI_EndPaint($hWnd, $tPaint)
            EndIf

            Return 0
        Case $WM_PARENTNOTIFY
            ; Fired when a child window is created inside the tab control.
            ; The tab spinner (msctls_updown32) is created lazily by Windows when tabs overflow -
            ; it doesn't exist at init time, so we theme it here the moment it appears.
            If _WinAPI_LoWord($wParam) = $WM_CREATE Then
                Local $hNewChild = HWnd($lParam) ; lParam carries the new child's HWND as integer - must cast!
                If _WinAPI_GetClassName($hNewChild) = "msctls_updown32" Then
                    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hNewChild, 'DarkMode_DarkTheme')
                EndIf
            EndIf
            Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    EndSwitch

    Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_ModernTabProc

Func _is24H2Plus()
    ; check if this OS build is Windows 11 24H2/25H2 to support the newer DarkMode_DarkTheme
    Local $iRevision = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR")
    Local $b24H2Plus = False
    If @OSBuild >= 26100 And $iRevision >= 6899 Then
        $b24H2Plus = True
    Else
        ConsoleWrite("Windows 11 24H2/25H2 (build 26100.6899 or higher) is required to use DarkMode_DarkTheme.")
    EndIf
    Return $b24H2Plus
EndFunc

Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0)
    Local $ret = DllCall('user32.dll', "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    Return DllCall('comctl32.dll', 'lresult', 'DefSubclassProc', 'hwnd', $hWnd, 'uint', $iMsg, 'wparam', $wParam, _
            'lparam', $lParam)[0]
EndFunc   ;==>__WinAPI_DefSubclassProc

Func _ColorToCOLORREF($iColor) ;RGB to BGR
    Local $iR = BitAND(BitShift($iColor, 16), 0xFF)
    Local $iG = BitAND(BitShift($iColor, 8), 0xFF)
    Local $iB = BitAND($iColor, 0xFF)
    Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR)
EndFunc   ;==>_ColorToCOLORREF

 

Posted (edited)

Here is little modified example to mimic the window resize.
Could you say what is wrong ?
How I can notice the issue ?

;~ https://www.autoitscript.com/forum/topic/213699-how-can-i-determine-if-tab-item-is-visible-in-tab-control/#findComment-1552571

; From Nine
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>
#include <WindowsSysColorConstants.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Opt("MustDeclareVars", True)

Global $g_hPenAccent = _WinAPI_CreatePen($PS_SOLID, 2, _ColorToCOLORREF(0x0078D4))

Example()

Func Example()
    Local $hGUI = GUICreate("DarkTheme TabControl", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))

    GUISetBkColor(0x191919)
    GUISetFont(10, 300)

    Local $idTab = GUICtrlCreateTab(20, 20, 360, 260)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
    Local $hTab = GUICtrlGetHandle($idTab)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateLabel("label1", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW)
    GUICtrlCreateLabel("Resize GUI to trigger UpDown controls.", 30, 80, 300, 100)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateLabel("label3", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateLabel("label4", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("") ; end tabitem definition

    ; set DarkMode_DarkTheme visual theme on Tab control as long as OSBuild supports it
    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hTab, 'DarkMode_DarkTheme')

    ; get handle for UpDown control to apply theme
    Local $hUpDown = _WinAPI_FindWindowEx($hTab, "msctls_updown32")
    If _is24H2Plus() And $hUpDown Then _WinAPI_SetWindowTheme($hUpDown, 'DarkMode_DarkTheme')

    Local $pAddress = _WinAPI_GetWindowLong($hTab, $GWL_WNDPROC)
    Local $hSubclass = DllCallbackRegister(_ModernTabProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")
    _WinAPI_SetWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab, $pAddress)

    ; remove focus rectangle from tab control
    GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0)

    ; lower the Z-order of the tab control (helps fix various issues)
    _WinAPI_SetWindowPos($hTab, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOREDRAW, $SWP_NOSIZE))

    GUISetState()

    While 1
        WinMove($hGUI, "", 400, 300, (30 * Random(1, 10)) + 200)
        Sleep(10)
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_RemoveWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab)
    DllCallbackFree($hSubclass)
EndFunc   ;==>Example

Func _ModernTabProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData)
    #forceref $iID, $pData
    Local $iTabCount
;~  ConsoleWrite("- _WinAPI_GetClassName($hWnd) = " & _WinAPI_GetClassName($hWnd) & @CRLF)

;~  _WinAPI_GetClassName($hWnd) = "msctls_updown32"
    Switch $iMsg
        Case $WM_ERASEBKGND
            Return 1 ; Prevent background erase to avoid flicker

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint)
            Local $tRect2 = _WinAPI_GetClientRect($hWnd)
            Local $iW = $tRect2.Right
            Local $iH = $tRect2.Bottom

            Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap)

            Local $iUpDownWidth = 0

            Local Const $PRF_CHILDREN = 16
            Local Const $PRF_CLIENT = 4

            _SendMessage($hWnd, $WM_PRINTCLIENT, $hMemDC, BitOR($PRF_CLIENT, $PRF_CHILDREN))

            Local $hBrush = _WinAPI_CreateSolidBrush(0x191919)
            $iTabCount = _GUICtrlTab_GetItemCount($hWnd)

            If $iTabCount > 0 Then
                ; determine if tab control contains an UpDown (spin) control
                Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32")
                If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                    Local $tCR = _WinAPI_GetWindowRect($hTabUpDown)
                    Local $tPR = _WinAPI_GetWindowRect($hWnd)

                    ; get width of UpDown control
                    $iUpDownWidth = $tCR.Right - $tCR.Left

                    ; exclude UpDown control from being painted over
                    DllCall('gdi32.dll', "int", "ExcludeClipRect", "handle", $hDC, "int", $tCR.Left - $tPR.Left, "int", _
                            $tCR.Top - $tPR.Top - 1, "int", $tCR.Right - $tPR.Left, "int", $tCR.Bottom - $tPR.Top + 2)
                EndIf

                ; Draw selection indicator (top border for selected tab)
                Local $tRect, $iLeft, $iTop, $iRight, $iBottom
                $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0)
                Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0)
                For $i = 0 To $iTabCount - 1
                    Local $bSelected = ($i = $iCurSel)
                    If $bSelected Then
                        ; Get tab rectangle using TCM_GETITEMRECT
                        $tRect = DllStructCreate($tagRECT)
                        Local $aResult = DllCall('user32.dll', "lresult", "SendMessageW", _
                                "hwnd", $hWnd, _
                                "uint", $TCM_GETITEMRECT, _
                                "wparam", $i, _
                                "struct*", $tRect)
                        If @error Or Not $aResult[0] Then ContinueLoop

                        $iLeft = $tRect.Left
                        $iTop = $tRect.Top
                        $iRight = $tRect.Right
                        $iBottom = $tRect.Bottom

                        ;If _GUICtrlTab_HitTest($hWnd, 10, 10)[0] <> 0 Then ConsoleWrite("tab on left is not 0" & @CRLF)
                        ;ConsoleWrite("tab on left: " & _GUICtrlTab_HitTest($hWnd, 10, 10)[0] & @CRLF)
                        ; adjustment for UpDown
                        ;Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                        If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                            Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                            If $iTabOnLeft <> 0 Then $iRight = $tRect.Right
                            If $iTabOnLeft = 0 And $iCurSel <> 0 Then $iRight = $tRect.Right - 2
                            ; if tab on left <> selected tab...
                        EndIf
                        ConsoleWrite(@CRLF)
                        ConsoleWrite("$tRect.Left: " & $tRect.Left & @CRLF)
                        ConsoleWrite("$tRect.Top: " & $tRect.Top & @CRLF)
                        ConsoleWrite("$tRect.Right: " & $tRect.Right & @CRLF)
                        ConsoleWrite("$tRect.Bottom: " & $tRect.Bottom & @CRLF)
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $i <> 0 Then $iRight = $tRect.Right - 2
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $iTabOnLeft <> 0 Then $iRight = $tRect.Right

                        ; Skip if rectangle is invalid
                        If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop
                        Local $hPen = $g_hPenAccent
                        Local $hOldPen = _WinAPI_SelectObject($hMemDC, $hPen)
                        _WinAPI_MoveTo($hMemDC, $iLeft - 1, $iTop - 1)
                        _WinAPI_LineTo($hMemDC, $iRight, $iTop - 2)
                        _WinAPI_SelectObject($hMemDC, $hOldPen)
                    EndIf

                    _WinAPI_SelectObject($hMemDC, $hBrush)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.right - 1 - $iUpDownWidth, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.left + 1, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                Next

                _WinAPI_DeleteObject($hBrush)
                _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY)

                _WinAPI_SelectObject($hMemDC, $hOldBmp)
                _WinAPI_DeleteObject($hBitmap)
                _WinAPI_DeleteDC($hMemDC)
                _WinAPI_EndPaint($hWnd, $tPaint)
            EndIf

            Return 0
        Case $WM_PARENTNOTIFY
            ; Fired when a child window is created inside the tab control.
            ; The tab spinner (msctls_updown32) is created lazily by Windows when tabs overflow -
            ; it doesn't exist at init time, so we theme it here the moment it appears.
            If _WinAPI_LoWord($wParam) = $WM_CREATE Then
                Local $hNewChild = HWnd($lParam) ; lParam carries the new child's HWND as integer - must cast!
                If _WinAPI_GetClassName($hNewChild) = "msctls_updown32" Then
                    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hNewChild, 'DarkMode_DarkTheme')
                EndIf
            EndIf
            Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    EndSwitch

    Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_ModernTabProc

Func _is24H2Plus()
    ; check if this OS build is Windows 11 24H2/25H2 to support the newer DarkMode_DarkTheme
    Local $iRevision = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR")
    Local $b24H2Plus = False
    If @OSBuild >= 26100 And $iRevision >= 6899 Then
        $b24H2Plus = True
    Else
        ConsoleWrite("Windows 11 24H2/25H2 (build 26100.6899 or higher) is required to use DarkMode_DarkTheme.")
    EndIf
    Return $b24H2Plus
EndFunc   ;==>_is24H2Plus

Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0)
    Local $ret = DllCall('user32.dll', "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    Return DllCall('comctl32.dll', 'lresult', 'DefSubclassProc', 'hwnd', $hWnd, 'uint', $iMsg, 'wparam', $wParam, _
            'lparam', $lParam)[0]
EndFunc   ;==>__WinAPI_DefSubclassProc

Func _ColorToCOLORREF($iColor) ;RGB to BGR
    Local $iR = BitAND(BitShift($iColor, 16), 0xFF)
    Local $iG = BitAND(BitShift($iColor, 8), 0xFF)
    Local $iB = BitAND($iColor, 0xFF)
    Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR)
EndFunc   ;==>_ColorToCOLORREF

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted
15 minutes ago, mLipok said:

Could you say what is wrong ?
How I can notice the issue ?

What happens (less now) is that the small blue strip painted on top of the selected tab can sometimes be 2 pixels to short or 2 pixels too long, horizontally.

It was happening in a few different scenarios. My fixes resolved two of the scenarios which is good.

But there is still one scenario that can trigger it which is when you resize the GUI horizontally small enough so that you see 2 and a half tabs. It has to be half tab showing to trigger. Then, when only 2 and a half tabs are showing, click on those tabs normally and sometimes the blue is shorter or longer by 2 pixels. It seems to only happen when Tab0 is showing. So having tabs 0, 1 and half of tab 2 should trigger the issue.

Posted

modified:

While 1
        WinMove($hGUI, "", 400, 300, (20 * Random(1, 3, 2)) + 180)
        Sleep(400)
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

full example:

;~ https://www.autoitscript.com/forum/topic/213699-how-can-i-determine-if-tab-item-is-visible-in-tab-control/#findComment-1552571

; From Nine
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>
#include <WindowsSysColorConstants.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Opt("MustDeclareVars", True)

Global $g_hPenAccent = _WinAPI_CreatePen($PS_SOLID, 2, _ColorToCOLORREF(0x0078D4))

Example()

Func Example()
    Local $hGUI = GUICreate("DarkTheme TabControl", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))

    GUISetBkColor(0x191919)
    GUISetFont(10, 300)

    Local $idTab = GUICtrlCreateTab(20, 20, 360, 260)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
    Local $hTab = GUICtrlGetHandle($idTab)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateLabel("label1", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW)
    GUICtrlCreateLabel("Resize GUI to trigger UpDown controls.", 30, 80, 300, 100)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateLabel("label3", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateLabel("label4", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("") ; end tabitem definition

    ; set DarkMode_DarkTheme visual theme on Tab control as long as OSBuild supports it
    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hTab, 'DarkMode_DarkTheme')

    ; get handle for UpDown control to apply theme
    Local $hUpDown = _WinAPI_FindWindowEx($hTab, "msctls_updown32")
    If _is24H2Plus() And $hUpDown Then _WinAPI_SetWindowTheme($hUpDown, 'DarkMode_DarkTheme')

    Local $pAddress = _WinAPI_GetWindowLong($hTab, $GWL_WNDPROC)
    Local $hSubclass = DllCallbackRegister(_ModernTabProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")
    _WinAPI_SetWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab, $pAddress)

    ; remove focus rectangle from tab control
    GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0)

    ; lower the Z-order of the tab control (helps fix various issues)
    _WinAPI_SetWindowPos($hTab, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOREDRAW, $SWP_NOSIZE))

    GUISetState()

    While 1
        WinMove($hGUI, "", 400, 300, (20 * Random(1, 3, 2)) + 180)
        Sleep(400)
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_RemoveWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab)
    DllCallbackFree($hSubclass)
EndFunc   ;==>Example

Func _ModernTabProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData)
    #forceref $iID, $pData
    Local $iTabCount
;~  ConsoleWrite("- _WinAPI_GetClassName($hWnd) = " & _WinAPI_GetClassName($hWnd) & @CRLF)

;~  _WinAPI_GetClassName($hWnd) = "msctls_updown32"
    Switch $iMsg
        Case $WM_ERASEBKGND
            Return 1 ; Prevent background erase to avoid flicker

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint)
            Local $tRect2 = _WinAPI_GetClientRect($hWnd)
            Local $iW = $tRect2.Right
            Local $iH = $tRect2.Bottom

            Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap)

            Local $iUpDownWidth = 0

            Local Const $PRF_CHILDREN = 16
            Local Const $PRF_CLIENT = 4

            _SendMessage($hWnd, $WM_PRINTCLIENT, $hMemDC, BitOR($PRF_CLIENT, $PRF_CHILDREN))

            Local $hBrush = _WinAPI_CreateSolidBrush(0x191919)
            $iTabCount = _GUICtrlTab_GetItemCount($hWnd)

            If $iTabCount > 0 Then
                ; determine if tab control contains an UpDown (spin) control
                Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32")
                If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                    Local $tCR = _WinAPI_GetWindowRect($hTabUpDown)
                    Local $tPR = _WinAPI_GetWindowRect($hWnd)

                    ; get width of UpDown control
                    $iUpDownWidth = $tCR.Right - $tCR.Left

                    ; exclude UpDown control from being painted over
                    DllCall('gdi32.dll', "int", "ExcludeClipRect", "handle", $hDC, "int", $tCR.Left - $tPR.Left, "int", _
                            $tCR.Top - $tPR.Top - 1, "int", $tCR.Right - $tPR.Left, "int", $tCR.Bottom - $tPR.Top + 2)
                EndIf

                ; Draw selection indicator (top border for selected tab)
                Local $tRect, $iLeft, $iTop, $iRight, $iBottom
                $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0)
                Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0)
                For $i = 0 To $iTabCount - 1
                    Local $bSelected = ($i = $iCurSel)
                    If $bSelected Then
                        ; Get tab rectangle using TCM_GETITEMRECT
                        $tRect = DllStructCreate($tagRECT)
                        Local $aResult = DllCall('user32.dll', "lresult", "SendMessageW", _
                                "hwnd", $hWnd, _
                                "uint", $TCM_GETITEMRECT, _
                                "wparam", $i, _
                                "struct*", $tRect)
                        If @error Or Not $aResult[0] Then ContinueLoop

                        $iLeft = $tRect.Left
                        $iTop = $tRect.Top
                        $iRight = $tRect.Right
                        $iBottom = $tRect.Bottom

                        ;If _GUICtrlTab_HitTest($hWnd, 10, 10)[0] <> 0 Then ConsoleWrite("tab on left is not 0" & @CRLF)
                        ;ConsoleWrite("tab on left: " & _GUICtrlTab_HitTest($hWnd, 10, 10)[0] & @CRLF)
                        ; adjustment for UpDown
                        ;Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                        If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                            Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                            If $iTabOnLeft <> 0 Then $iRight = $tRect.Right
                            If $iTabOnLeft = 0 And $iCurSel <> 0 Then $iRight = $tRect.Right - 2
                            ; if tab on left <> selected tab...
                        EndIf
                        ConsoleWrite(@CRLF)
                        ConsoleWrite("$tRect.Left: " & $tRect.Left & @CRLF)
                        ConsoleWrite("$tRect.Top: " & $tRect.Top & @CRLF)
                        ConsoleWrite("$tRect.Right: " & $tRect.Right & @CRLF)
                        ConsoleWrite("$tRect.Bottom: " & $tRect.Bottom & @CRLF)
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $i <> 0 Then $iRight = $tRect.Right - 2
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $iTabOnLeft <> 0 Then $iRight = $tRect.Right

                        ; Skip if rectangle is invalid
                        If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop
                        Local $hPen = $g_hPenAccent
                        Local $hOldPen = _WinAPI_SelectObject($hMemDC, $hPen)
                        _WinAPI_MoveTo($hMemDC, $iLeft - 1, $iTop - 1)
                        _WinAPI_LineTo($hMemDC, $iRight, $iTop - 2)
                        _WinAPI_SelectObject($hMemDC, $hOldPen)
                    EndIf

                    _WinAPI_SelectObject($hMemDC, $hBrush)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.right - 1 - $iUpDownWidth, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.left + 1, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                Next

                _WinAPI_DeleteObject($hBrush)
                _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY)

                _WinAPI_SelectObject($hMemDC, $hOldBmp)
                _WinAPI_DeleteObject($hBitmap)
                _WinAPI_DeleteDC($hMemDC)
                _WinAPI_EndPaint($hWnd, $tPaint)
            EndIf

            Return 0
        Case $WM_PARENTNOTIFY
            ; Fired when a child window is created inside the tab control.
            ; The tab spinner (msctls_updown32) is created lazily by Windows when tabs overflow -
            ; it doesn't exist at init time, so we theme it here the moment it appears.
            If _WinAPI_LoWord($wParam) = $WM_CREATE Then
                Local $hNewChild = HWnd($lParam) ; lParam carries the new child's HWND as integer - must cast!
                If _WinAPI_GetClassName($hNewChild) = "msctls_updown32" Then
                    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hNewChild, 'DarkMode_DarkTheme')
                EndIf
            EndIf
            Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    EndSwitch

    Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_ModernTabProc

Func _is24H2Plus()
    ; check if this OS build is Windows 11 24H2/25H2 to support the newer DarkMode_DarkTheme
    Local $iRevision = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR")
    Local $b24H2Plus = False
    If @OSBuild >= 26100 And $iRevision >= 6899 Then
        $b24H2Plus = True
    Else
        ConsoleWrite("Windows 11 24H2/25H2 (build 26100.6899 or higher) is required to use DarkMode_DarkTheme.")
    EndIf
    Return $b24H2Plus
EndFunc   ;==>_is24H2Plus

Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0)
    Local $ret = DllCall('user32.dll', "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    Return DllCall('comctl32.dll', 'lresult', 'DefSubclassProc', 'hwnd', $hWnd, 'uint', $iMsg, 'wparam', $wParam, _
            'lparam', $lParam)[0]
EndFunc   ;==>__WinAPI_DefSubclassProc

Func _ColorToCOLORREF($iColor) ;RGB to BGR
    Local $iR = BitAND(BitShift($iColor, 16), 0xFF)
    Local $iG = BitAND(BitShift($iColor, 8), 0xFF)
    Local $iB = BitAND($iColor, 0xFF)
    Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR)
EndFunc   ;==>_ColorToCOLORREF

Still wondering how to notice the issue.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted
6 minutes ago, mLipok said:

Still wondering how to notice the issue.

Maybe that is a good thing. 😀

Anyway I won’t be at my PC for a few hours so I can’t test anything right now. I can do a screenshot of issue later.

If you have Tab1 selected (while Tab0 is visible) and then resize the GUI very small horizontally you should be able to see Tab1 blue line shorter or longer by 2 pixels.

By the way, I haven’t had a chance to test your examples yet. So maybe you have fixed it in your examples.

I will dig in more in a few hours.

Posted (edited)

Found it 100% example:
Note that tab2 size is changing but the blue line above stays with the same size

;~ https://www.autoitscript.com/forum/topic/213699-how-can-i-determine-if-tab-item-is-visible-in-tab-control/#findComment-1552580

; From Nine
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <GuiTab.au3>
#include <WindowsSysColorConstants.au3>
#include <WinAPITheme.au3>

; initiate System DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Opt("MustDeclareVars", True)

Global $g_hPenAccent = _WinAPI_CreatePen($PS_SOLID, 2, _ColorToCOLORREF(0x0078D4))

Example()

Func Example()
    Local $hGUI = GUICreate("DarkTheme TabControl", 400, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP))

    GUISetBkColor(0x191919)
    GUISetFont(10, 300)

    Local $idTab = GUICtrlCreateTab(20, 20, 360, 260)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
    Local $hTab = GUICtrlGetHandle($idTab)

    GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab1")
    GUICtrlCreateLabel("label1", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW)
    GUICtrlCreateLabel("Resize GUI to trigger"&@CRLF&"UpDown controls.", 30, 80, 300, 30)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    Local $iLable_size = GUICtrlCreateLabel("Width", 30, 130, 200, 30)
    GUICtrlSetColor(-1, 0x00FF10)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    GUICtrlCreateLabel('Note that "tab2" size is changing but the blue line above stays with the same size', 30, 160, 240, 90)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab3")
    GUICtrlCreateLabel("label3", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("tab4")
    GUICtrlCreateLabel("label4", 30, 80, 300, 60)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x262626)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    GUICtrlCreateTabItem("") ; end tabitem definition

    ; set DarkMode_DarkTheme visual theme on Tab control as long as OSBuild supports it
    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hTab, 'DarkMode_DarkTheme')

    ; get handle for UpDown control to apply theme
    Local $hUpDown = _WinAPI_FindWindowEx($hTab, "msctls_updown32")
    If _is24H2Plus() And $hUpDown Then _WinAPI_SetWindowTheme($hUpDown, 'DarkMode_DarkTheme')

    Local $pAddress = _WinAPI_GetWindowLong($hTab, $GWL_WNDPROC)
    Local $hSubclass = DllCallbackRegister(_ModernTabProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr")
    _WinAPI_SetWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab, $pAddress)

    ; remove focus rectangle from tab control
    GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0)

    _GUICtrlTab_ActivateTab($idTab, 1)

    ; lower the Z-order of the tab control (helps fix various issues)
    _WinAPI_SetWindowPos($hTab, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOREDRAW, $SWP_NOSIZE))

    GUISetState()

    While 1
        WinMove($hGUI, "", 400, 300, (8 * Random(0, 1, 1)) + 240)
        GUICtrlSetData($iLable_size, "GUI width=" & WinGetPos($hGUI, "")[2])
        Sleep(400)
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _WinAPI_RemoveWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab)
    DllCallbackFree($hSubclass)
EndFunc   ;==>Example

Func _ModernTabProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData)
    #forceref $iID, $pData
    Local $iTabCount
;~  ConsoleWrite("- _WinAPI_GetClassName($hWnd) = " & _WinAPI_GetClassName($hWnd) & @CRLF)

;~  _WinAPI_GetClassName($hWnd) = "msctls_updown32"
    Switch $iMsg
        Case $WM_ERASEBKGND
            Return 1 ; Prevent background erase to avoid flicker

        Case $WM_PAINT
            Local $tPaint = DllStructCreate($tagPAINTSTRUCT)
            Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint)
            Local $tRect2 = _WinAPI_GetClientRect($hWnd)
            Local $iW = $tRect2.Right
            Local $iH = $tRect2.Bottom

            Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
            Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
            Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap)

            Local $iUpDownWidth = 0

            Local Const $PRF_CHILDREN = 16
            Local Const $PRF_CLIENT = 4

            _SendMessage($hWnd, $WM_PRINTCLIENT, $hMemDC, BitOR($PRF_CLIENT, $PRF_CHILDREN))

            Local $hBrush = _WinAPI_CreateSolidBrush(0x191919)
            $iTabCount = _GUICtrlTab_GetItemCount($hWnd)

            If $iTabCount > 0 Then
                ; determine if tab control contains an UpDown (spin) control
                Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32")
                If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                    Local $tCR = _WinAPI_GetWindowRect($hTabUpDown)
                    Local $tPR = _WinAPI_GetWindowRect($hWnd)

                    ; get width of UpDown control
                    $iUpDownWidth = $tCR.Right - $tCR.Left

                    ; exclude UpDown control from being painted over
                    DllCall('gdi32.dll', "int", "ExcludeClipRect", "handle", $hDC, "int", $tCR.Left - $tPR.Left, "int", _
                            $tCR.Top - $tPR.Top - 1, "int", $tCR.Right - $tPR.Left, "int", $tCR.Bottom - $tPR.Top + 2)
                EndIf

                ; Draw selection indicator (top border for selected tab)
                Local $tRect, $iLeft, $iTop, $iRight, $iBottom
                $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0)
                Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0)
                For $i = 0 To $iTabCount - 1
                    Local $bSelected = ($i = $iCurSel)
                    If $bSelected Then
                        ; Get tab rectangle using TCM_GETITEMRECT
                        $tRect = DllStructCreate($tagRECT)
                        Local $aResult = DllCall('user32.dll', "lresult", "SendMessageW", _
                                "hwnd", $hWnd, _
                                "uint", $TCM_GETITEMRECT, _
                                "wparam", $i, _
                                "struct*", $tRect)
                        If @error Or Not $aResult[0] Then ContinueLoop

                        $iLeft = $tRect.Left
                        $iTop = $tRect.Top
                        $iRight = $tRect.Right
                        $iBottom = $tRect.Bottom

                        ;If _GUICtrlTab_HitTest($hWnd, 10, 10)[0] <> 0 Then ConsoleWrite("tab on left is not 0" & @CRLF)
                        ;ConsoleWrite("tab on left: " & _GUICtrlTab_HitTest($hWnd, 10, 10)[0] & @CRLF)
                        ; adjustment for UpDown
                        ;Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                        If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then
                            Local $iTabOnLeft = _GUICtrlTab_HitTest($hWnd, 10, 10)[0]
                            If $iTabOnLeft <> 0 Then $iRight = $tRect.Right
                            If $iTabOnLeft = 0 And $iCurSel <> 0 Then $iRight = $tRect.Right - 2
                            ; if tab on left <> selected tab...
                        EndIf
                        ConsoleWrite(@CRLF)
                        ConsoleWrite("$tRect.Left: " & $tRect.Left & @CRLF)
                        ConsoleWrite("$tRect.Top: " & $tRect.Top & @CRLF)
                        ConsoleWrite("$tRect.Right: " & $tRect.Right & @CRLF)
                        ConsoleWrite("$tRect.Bottom: " & $tRect.Bottom & @CRLF)
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $i <> 0 Then $iRight = $tRect.Right - 2
                        ;If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) And $iTabOnLeft <> 0 Then $iRight = $tRect.Right

                        ; Skip if rectangle is invalid
                        If $iLeft >= $iRight Or $iTop >= $iBottom Then ContinueLoop
                        Local $hPen = $g_hPenAccent
                        Local $hOldPen = _WinAPI_SelectObject($hMemDC, $hPen)
                        _WinAPI_MoveTo($hMemDC, $iLeft - 1, $iTop - 1)
                        _WinAPI_LineTo($hMemDC, $iRight, $iTop - 2)
                        _WinAPI_SelectObject($hMemDC, $hOldPen)
                    EndIf

                    _WinAPI_SelectObject($hMemDC, $hBrush)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.right - 1 - $iUpDownWidth, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                    _WinAPI_ExtFloodFill($hMemDC, $tRect2.left + 1, 1, 0xf0f0f0, $FLOODFILLSURFACE)
                Next

                _WinAPI_DeleteObject($hBrush)
                _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY)

                _WinAPI_SelectObject($hMemDC, $hOldBmp)
                _WinAPI_DeleteObject($hBitmap)
                _WinAPI_DeleteDC($hMemDC)
                _WinAPI_EndPaint($hWnd, $tPaint)
            EndIf

            Return 0
        Case $WM_PARENTNOTIFY
            ; Fired when a child window is created inside the tab control.
            ; The tab spinner (msctls_updown32) is created lazily by Windows when tabs overflow -
            ; it doesn't exist at init time, so we theme it here the moment it appears.
            If _WinAPI_LoWord($wParam) = $WM_CREATE Then
                Local $hNewChild = HWnd($lParam) ; lParam carries the new child's HWND as integer - must cast!
                If _WinAPI_GetClassName($hNewChild) = "msctls_updown32" Then
                    If _is24H2Plus() Then _WinAPI_SetWindowTheme($hNewChild, 'DarkMode_DarkTheme')
                EndIf
            EndIf
            Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    EndSwitch

    Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>_ModernTabProc

Func _is24H2Plus()
    ; check if this OS build is Windows 11 24H2/25H2 to support the newer DarkMode_DarkTheme
    Local $iRevision = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "UBR")
    Local $b24H2Plus = False
    If @OSBuild >= 26100 And $iRevision >= 6899 Then
        $b24H2Plus = True
    Else
        ConsoleWrite("Windows 11 24H2/25H2 (build 26100.6899 or higher) is required to use DarkMode_DarkTheme.")
    EndIf
    Return $b24H2Plus
EndFunc   ;==>_is24H2Plus

Func _WinAPI_FindWindowEx($hParent, $sClass, $sTitle = "", $hAfter = 0)
    Local $ret = DllCall('user32.dll', "hwnd", "FindWindowExW", "hwnd", $hParent, "hwnd", $hAfter, "wstr", $sClass, "wstr", $sTitle)
    If @error Or Not IsArray($ret) Then Return 0
    Return $ret[0]
EndFunc   ;==>_WinAPI_FindWindowEx

Func __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    Return DllCall('comctl32.dll', 'lresult', 'DefSubclassProc', 'hwnd', $hWnd, 'uint', $iMsg, 'wparam', $wParam, _
            'lparam', $lParam)[0]
EndFunc   ;==>__WinAPI_DefSubclassProc

Func _ColorToCOLORREF($iColor) ;RGB to BGR
    Local $iR = BitAND(BitShift($iColor, 16), 0xFF)
    Local $iG = BitAND(BitShift($iColor, 8), 0xFF)
    Local $iB = BitAND($iColor, 0xFF)
    Return BitOR(BitShift($iB, -16), BitShift($iG, -8), $iR)
EndFunc   ;==>_ColorToCOLORREF

 

Edited by mLipok
script modified

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

hey you know what ?
I have an idea: Try to focus on how the "frame" is drawn here

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...