-
Posts
11,970 -
Joined
-
Last visited
-
Days Won
68
mLipok last won the day on May 11
mLipok had the most liked content!
About mLipok

- Birthday 07/19/1978
Profile Information
-
Member Title
Sometimes... even usually I'm nitpicky.
-
Location
Europe, Poland, Upper Silesia, Zabrze
-
Interests
¯\_(ツ)_/¯
Recent Profile Visitors
30,725 profile views
mLipok's Achievements
-
mLipok reacted to a post in a topic:
GUIDarkTheme UDF
-
mLipok reacted to a post in a topic:
GUIDarkTheme UDF
-
WildByDesign reacted to a post in a topic:
GUIDarkTheme UDF
-
Thanks to you both for answers. Ok. do you mean for example: __DM_WinAPI_GetDeviceCaps() which is currently in UDF as _WinAPI_GetDeviceCaps() and acts exactly the same way ? or __DM_WinAPI_GetTextExtentPoint32() >> _WinAPI_GetTextExtentPoint32()
-
mLipok reacted to a post in a topic:
Help File/Documentation Issues. (Discussion Only)
-
WildByDesign reacted to a post in a topic:
GUIDarkTheme UDF
-
As long as you remember... please add standard header generated by SciTE (CTRL + ALT + H) to each Func __DM_WinAPI_ and fullfill the ; Author ........: ????? information You can keep all others information not changed (as SciTE generate them).
-
WildByDesign reacted to a post in a topic:
GUIDarkTheme UDF
-
Please take a look on: https://www.autoitscript.com/trac/autoit/ticket/4095 as you are creator of ths function I would like to ask you to give your opinion on that sugestion/feature request to the UDF.
-
Help File/Documentation Issues. (Discussion Only)
mLipok replied to guinness's topic in AutoIt Technical Discussion
I would like to politely remind you about this problem. -
mLipok reacted to a post in a topic:
_GUIImageList_AddIcon() function and negative integers for indexes .
-
I tried to get it to work. Without success. Can anyone confirm this isn't working? Or fix it?
-
I was trying to use _WinAPI_CompressBitmapBits.au3 example from the helpfile #include "Extras\HelpFileInternals.au3" #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <WinAPIGdi.au3> #include <WinAPIHObj.au3> #include <WinAPIMem.au3> #include <WinAPIRes.au3> _Example() Func _Example() ; Load image Local $sBmp = _Extras_PathFull('AutoIt.bmp') Local $hSource = _WinAPI_LoadImage(0, $sBmp, $IMAGE_BITMAP, 0, 0, BitOR($LR_LOADFROMFILE, $LR_CREATEDIBSECTION)) ; Resize bitmap to 256x256 pixels Local $hBitmap = _WinAPI_AdjustBitmap($hSource, 256, 256, $HALFTONE) ; Create compressed PNG data Local $pData = 0 Local $iLength = _WinAPI_CompressBitmapBits($hBitmap, $pData, 2) ;$COMPRESSION_BITMAP_PNG) ; Create .ico file If Not @error Then Local $tICO = DllStructCreate('align 1;ushort Reserved;ushort Type;ushort Count;byte Header[20]') Local $tHDR = DllStructCreate('byte Width;byte Height;byte ColorCount;byte Reserved;ushort Planes;ushort BitCount;long Size;long Offset', DllStructGetPtr($tICO, 'Header')) DllStructSetData($tICO, 'Reserved', 0) DllStructSetData($tICO, 'Type', 1) DllStructSetData($tICO, 'Count', 1) DllStructSetData($tHDR, 'Width', 0) DllStructSetData($tHDR, 'Height', 0) DllStructSetData($tHDR, 'ColorCount', 0) DllStructSetData($tHDR, 'Reserved', 0) DllStructSetData($tHDR, 'Planes', 1) DllStructSetData($tHDR, 'BitCount', 32) DllStructSetData($tHDR, 'Size', $iLength) DllStructSetData($tHDR, 'Offset', DllStructGetSize($tICO)) Local $hFile = _WinAPI_CreateFile(@TempDir & '\MyIcon.ico', 1, 4) Local $iBytes _WinAPI_WriteFile($hFile, $tICO, DllStructGetSize($tICO), $iBytes) _WinAPI_WriteFile($hFile, $pData, $iLength, $iBytes) _WinAPI_CloseHandle($hFile) ShellExecute("MsPaint", '"' & @TempDir & '\MyIcon.ico' & '"') Else MsgBox($MB_SYSTEMMODAL, "Error", "_WinAPI_CompressBitmapBits() failed (@error = " & @error & ")") EndIf ; Delete unnecessary bitmaps _WinAPI_DeleteObject($hSource) _WinAPI_DeleteObject($hBitmap) ; Free memory _WinAPI_FreeMemory($pData) EndFunc ;==>_Example I get: Any help please.
-
mLipok reacted to a post in a topic:
GUIDarkTheme UDF
-
mLipok reacted to a post in a topic:
GUIDarkTheme UDF
-
WildByDesign reacted to a post in a topic:
GUIDarkTheme UDF
-
WildByDesign reacted to a post in a topic:
GUIDarkTheme UDF
-
it was introduced: From this time only occasionally, some examples in HelpFile were changed. Even more, many Standard UDF's are still not ready for Au3Stripper.
-
Good Au3Stripper with those parameters #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/rm /sv /sf was stripping name of the function not strings which looks like function names for this reason only function declaration (name of the function) was stripped, and not the string OnAutoItExitRegister("__GUIDarkTheme_OnExit") Func __GUIDarkTheme_OnExit() ..... EndFunc ;==>__GUIDarkTheme_OnExit in scenario in the following snippet function declaration and function usage (name of the function) is stripped: OnAutoItExitRegister(__GUIDarkTheme_OnExit) Func __GUIDarkTheme_OnExit() ..... EndFunc ;==>__GUIDarkTheme_OnExit Au3Stripper never strips Strings enclosed within double or single quotes.
-
WildByDesign reacted to a post in a topic:
How can I determine if tab item is visible in tab control?
-
Please check the following example focusing on #Region ; Fill tab background #Region ; *** Dynamically added Include files *** #include <Array.au3> ; added:05/16/26 00:23:43 #EndRegion ; *** Dynamically added Include files *** #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <TabConstants.au3> #include <WindowsNotifsConstants.au3> #include <WindowsSysColorConstants.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> ; Initialize System DPI awareness DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2) Global $g_hTab_CB, $g_pTab_CB, $g_hProc, $g_hTab Global Const $COLOR_BUTTON_BG = 0x383838, $COLOR_BG_DARK = 0x202020, $COLOR_GUI_BG = 0x101010, $COLOR_BORDER = 0x606060, $COLOR_BORDER_DARK = 0x303030 Example() Func Example() Local $hGUI = GUICreate("DarkTheme TabControl (24H2/25H2)", 500, 300) GUISetBkColor($COLOR_GUI_BG) GUISetFont(10) Local $idTab = GUICtrlCreateTab(20, 20, 460, 260) $g_hTab = GUICtrlGetHandle($idTab) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateTabItem("tab3") GUICtrlCreateTabItem("tab4") ; Remove focus rectangle from tab control GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0) ; Set dark titlebar _WinAPI_DwmSetWindowAttribute($hGUI, $DWMWA_USE_IMMERSIVE_DARK_MODE, True) ; Set theme if OS supports it If _is24H2Plus() Then _WinAPI_SetWindowTheme(GUICtrlGetHandle($idTab), 'DarkMode_DarkTheme') ; Register Subclassing / Window Procedure $g_hTab_CB = DllCallbackRegister(_WinProc, "ptr", "hwnd;uint;wparam;lparam") $g_pTab_CB = DllCallbackGetPtr($g_hTab_CB) $g_hProc = _WinAPI_SetWindowLong($g_hTab, $GWL_WNDPROC, $g_pTab_CB) GUISetState(@SW_SHOW) Local $idMsg While 1 $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop WEnd ; Cleanup: Restore original Window Procedure _WinAPI_SetWindowLong($g_hTab, $GWL_WNDPROC, $g_hProc) DllCallbackFree($g_hTab_CB) EndFunc ;==>Example 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." & @CRLF) EndIf Return $b24H2Plus EndFunc ;==>_is24H2Plus Func _WinProc($hWnd, $iMsg, $wParam, $lParam) ;coded by UEZ Switch $iMsg Case $WM_ERASEBKGND Return 1 ; Prevent background erasing to avoid flickering Case $WM_PAINT Local $tPaint = DllStructCreate($tagPAINTSTRUCT) Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint) If @error Or Not $hDC Then Return _WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam) Local $tClient = _WinAPI_GetClientRect($hWnd) Local $iWidth = $tClient.Right Local $iHeight = $tClient.Bottom ; Prepare Double Buffering Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight) Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap) ; --- 1. Clipping (Exclude child controls from drawing) --- Local $hParent = _WinAPI_GetParent($hWnd) Local $hChild = _WinAPI_GetWindow($hParent, $GW_CHILD) Local $tCR, $tPR = _WinAPI_GetWindowRect($hWnd) Local $left, $top, $right, $bottom While $hChild If $hChild <> $hWnd And _WinAPI_IsWindowVisible($hChild) Then $tCR = _WinAPI_GetWindowRect($hChild) If Not ($tCR.right < $tPR.left Or $tCR.left > $tPR.right Or $tCR.bottom < $tPR.top Or $tCR.top > $tPR.bottom) Then $left = Max($tCR.left, $tPR.left) - $tPR.left $top = Max($tCR.top, $tPR.top) - $tPR.top $right = Min($tCR.right, $tPR.right) - $tPR.left $bottom = Min($tCR.bottom, $tPR.bottom) - $tPR.top DllCall("gdi32.dll", "int", "ExcludeClipRect", "handle", $hMemDC, "int", $left, "int", $top, "int", $right, "int", $bottom) EndIf EndIf $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32") If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then $tCR = _WinAPI_GetWindowRect($hTabUpDown) If Not ($tCR.right < $tPR.left Or $tCR.left > $tPR.right Or $tCR.bottom < $tPR.top Or $tCR.top > $tPR.bottom) Then $left = Max($tCR.left, $tPR.left) - $tPR.left $top = Max($tCR.top, $tPR.top) - $tPR.top $right = Min($tCR.right, $tPR.right) - $tPR.left $bottom = Min($tCR.bottom, $tPR.bottom) - $tPR.top DllCall("gdi32.dll", "int", "ExcludeClipRect", "handle", $hMemDC, "int", $left, "int", $top, "int", $right, "int", $bottom) EndIf EndIf ; 2. Draw main background (Dark color) Local $hBrushBg = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) ; _WinAPI_FillRect($hMemDC, $tClient, $hBrushBg) Local $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0) Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0) ; 3. Prepare the Body Frame (The area beneath the tabs) Local $tFirstTabRect = DllStructCreate($tagRECT) _SendMessage($hWnd, $TCM_GETITEMRECT, 0, DllStructGetPtr($tFirstTabRect)) Local $tBodyRect = DllStructCreate($tagRECT) $tBodyRect.Left = 0 $tBodyRect.Top = $tFirstTabRect.Bottom ; Starts at the bottom edge of the tabs $tBodyRect.Right = $iWidth $tBodyRect.Bottom = $iHeight Local $hBrushBorder = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_RED)) _WinAPI_FrameRect($hMemDC, $tBodyRect, $hBrushBorder) ; 4. Draw the "Gap" to the right of the tabs in GUI background color If $iTabCount > 0 Then Local $tLastTabRect = DllStructCreate($tagRECT) _SendMessage($hWnd, $TCM_GETITEMRECT, $iTabCount - 1, DllStructGetPtr($tLastTabRect)) Local $tGapRect = DllStructCreate($tagRECT) $tGapRect.Left = $tLastTabRect.Right + 2 $tGapRect.Top = 0 $tGapRect.Right = $iWidth $tGapRect.Bottom = $tLastTabRect.Bottom Local $hBrushGui = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_GUI_BG)) _WinAPI_FillRect($hMemDC, $tGapRect, $hBrushGui) _WinAPI_DeleteObject($hBrushGui) EndIf _WinAPI_SetBkMode($hMemDC, 1) ; Transparent background for text ;~ _WinAPI_SetTextColor($hMemDC, _ColorToCOLORREF(0xF0F0F0)) ; 5. Draw individual tabs For $i = 0 To $iTabCount - 1 Local $tRECT = DllStructCreate($tagRECT) _SendMessage($hWnd, $TCM_GETITEMRECT, $i, DllStructGetPtr($tRECT)) If $tRECT.Right < 0 Or $tRECT.Left > $iWidth Then ContinueLoop $tRECT.top -= 2 #Region ; Fill tab background Local $aWinPos = WinGetPos($hWnd) Local $aMousePos = MouseGetPos() ConsoleWrite("$aWinPos : " & _ArrayToString($aWinPos) & @CRLF) ConsoleWrite("$aMousePos : " & _ArrayToString($aMousePos) & @CRLF) ConsoleWrite("HitTest : " & _ArrayToString(_GUICtrlTab_HitTest($hWnd, $aMousePos[0] - $aWinPos[0], $aMousePos[1] - $aWinPos[1])) & @CRLF) Local $bMouseOverTab = (_GUICtrlTab_HitTest($hWnd, $aMousePos[0] - $aWinPos[0], $aMousePos[1] - $aWinPos[1])[0] > -1) Local $bSelected = ($i = $iCurSel) Local $iTabColor = ($bSelected Or $bMouseOverTab) ? $COLOR_DARKSLATEGRAY : $COLOR_BG_DARK Local $hTabBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($iTabColor)) _WinAPI_FillRect($hMemDC, $tRECT, $hTabBrush) #EndRegion ; Fill tab background If $bSelected Then _WinAPI_SetTextColor($hMemDC, _WinAPI_SwitchColor($COLOR_VIOLET)) ; Draw border ONLY for the active tab (Top, Left, Right) _WinAPI_FrameRect($hMemDC, $tRECT, $hBrushBorder) Local $tOpenLine = DllStructCreate($tagRECT) $tOpenLine.Left = $tRECT.Left + 1 $tOpenLine.Top = $tRECT.Bottom - 1 ; Exactly on the border line of the body $tOpenLine.Right = $tRECT.Right - 1 $tOpenLine.Bottom = $tRECT.Bottom + 1 ; OPEN BOTTOM: Draw a line in tab-color over the body-border to merge them _WinAPI_FillRect($hMemDC, $tOpenLine, $hTabBrush) Else _WinAPI_SetTextColor($hMemDC, _WinAPI_SwitchColor($COLOR_RED)) ; Draw rectangle around non active tabs Local $hBrushTabRecDark = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BORDER_DARK)) _WinAPI_FrameRect($hMemDC, $tRECT, $hBrushTabRecDark) _WinAPI_DeleteObject($hBrushTabRecDark) EndIf _WinAPI_DeleteObject($hTabBrush) ; Draw text centered Local $sText = _GUICtrlTab_GetItemText($hWnd, $i) Local $tTextRect = DllStructCreate($tagRECT) With $tTextRect .Left = $tRECT.Left + 6 .Top = $tRECT.Top + ($bSelected ? 1 : 3) .Right = $tRECT.Right - 6 .Bottom = $tRECT.Bottom - 3 EndWith DllCall("user32.dll", "int", "DrawTextW", "handle", $hMemDC, "wstr", $sText, "int", -1, "struct*", $tTextRect, "uint", BitOR($DT_CENTER, $DT_VCENTER, $DT_SINGLELINE, $DT_NOPREFIX)) Next ; 6. Copy memory DC to screen DC (BitBlt) _WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hMemDC, 0, 0, $SRCCOPY) ; Cleanup _WinAPI_SelectObject($hMemDC, $hOldBmp) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hBrushBg) _WinAPI_DeleteObject($hBrushBorder) _WinAPI_DeleteDC($hMemDC) _WinAPI_EndPaint($hWnd, $tPaint) Return 0 EndSwitch Return _WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func _ColorToCOLORREF($iColor) ; Convert 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 Func Min($a, $b) Return ($a < $b ? $a : $b) EndFunc ;==>Min Func Max($a, $b) Return ($a > $b ? $a : $b) EndFunc ;==>Max 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 btw. there are some issues but it is a good start
-
mLipok reacted to a post in a topic:
GUIDarkTheme UDF
-
argumentum reacted to a post in a topic:
How can I determine if tab item is visible in tab control?
-
haha..... I do not see this issue in this example #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <GuiTab.au3> #include <TabConstants.au3> #include <WindowsNotifsConstants.au3> #include <WindowsSysColorConstants.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> ; Initialize System DPI awareness DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2) Global $g_hTab_CB, $g_pTab_CB, $g_hProc, $g_hTab Global Const $COLOR_BUTTON_BG = 0x383838, $COLOR_BG_DARK = 0x202020, $COLOR_GUI_BG = 0x101010, $COLOR_BORDER = 0x606060, $COLOR_BORDER_DARK = 0x303030 Example() Func Example() Local $hGUI = GUICreate("DarkTheme TabControl (24H2/25H2)", 500, 300) GUISetBkColor($COLOR_GUI_BG) GUISetFont(10) Local $idTab = GUICtrlCreateTab(20, 20, 460, 260) $g_hTab = GUICtrlGetHandle($idTab) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("tab3") GUICtrlCreateTabItem("tab4") ; Remove focus rectangle from tab control GUICtrlSendMsg($idTab, $WM_CHANGEUISTATE, 65537, 0) ; Set dark titlebar _WinAPI_DwmSetWindowAttribute($hGUI, $DWMWA_USE_IMMERSIVE_DARK_MODE, True) ; Set theme if OS supports it If _is24H2Plus() Then _WinAPI_SetWindowTheme(GUICtrlGetHandle($idTab), 'DarkMode_DarkTheme') ; Register Subclassing / Window Procedure $g_hTab_CB = DllCallbackRegister(_WinProc, "ptr", "hwnd;uint;wparam;lparam") $g_pTab_CB = DllCallbackGetPtr($g_hTab_CB) $g_hProc = _WinAPI_SetWindowLong($g_hTab, $GWL_WNDPROC, $g_pTab_CB) GUISetState(@SW_SHOW) Local $idMsg While 1 WinMove($hGUI, "", 400, 300, (8 * Random(0, 1, 1)) + 157) Sleep(400) $idMsg = GUIGetMsg() If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop WEnd ; Cleanup: Restore original Window Procedure _WinAPI_SetWindowLong($g_hTab, $GWL_WNDPROC, $g_hProc) DllCallbackFree($g_hTab_CB) EndFunc ;==>Example 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." & @CRLF) EndIf Return $b24H2Plus EndFunc ;==>_is24H2Plus Func _WinProc($hWnd, $iMsg, $wParam, $lParam) ;coded by UEZ Switch $iMsg Case $WM_ERASEBKGND Return 1 ; Prevent background erasing to avoid flickering Case $WM_PAINT Local $tPaint = DllStructCreate($tagPAINTSTRUCT) Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint) If @error Or Not $hDC Then Return _WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam) Local $tClient = _WinAPI_GetClientRect($hWnd) Local $iWidth = $tClient.Right Local $iHeight = $tClient.Bottom ; Prepare Double Buffering Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight) Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap) ; --- 1. Clipping (Exclude child controls from drawing) --- Local $hParent = _WinAPI_GetParent($hWnd) Local $hChild = _WinAPI_GetWindow($hParent, $GW_CHILD) Local $tCR, $tPR = _WinAPI_GetWindowRect($hWnd) Local $left, $top, $right, $bottom While $hChild If $hChild <> $hWnd And _WinAPI_IsWindowVisible($hChild) Then $tCR = _WinAPI_GetWindowRect($hChild) If Not ($tCR.right < $tPR.left Or $tCR.left > $tPR.right Or $tCR.bottom < $tPR.top Or $tCR.top > $tPR.bottom) Then $left = Max($tCR.left, $tPR.left) - $tPR.left $top = Max($tCR.top, $tPR.top) - $tPR.top $right = Min($tCR.right, $tPR.right) - $tPR.left $bottom = Min($tCR.bottom, $tPR.bottom) - $tPR.top DllCall("gdi32.dll", "int", "ExcludeClipRect", "handle", $hMemDC, "int", $left, "int", $top, "int", $right, "int", $bottom) EndIf EndIf $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32") If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then $tCR = _WinAPI_GetWindowRect($hTabUpDown) If Not ($tCR.right < $tPR.left Or $tCR.left > $tPR.right Or $tCR.bottom < $tPR.top Or $tCR.top > $tPR.bottom) Then $left = Max($tCR.left, $tPR.left) - $tPR.left $top = Max($tCR.top, $tPR.top) - $tPR.top $right = Min($tCR.right, $tPR.right) - $tPR.left $bottom = Min($tCR.bottom, $tPR.bottom) - $tPR.top DllCall("gdi32.dll", "int", "ExcludeClipRect", "handle", $hMemDC, "int", $left, "int", $top, "int", $right, "int", $bottom) EndIf EndIf ; 2. Draw main background (Dark color) Local $hBrushBg = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BG_DARK)) ; _WinAPI_FillRect($hMemDC, $tClient, $hBrushBg) Local $iTabCount = _SendMessage($hWnd, $TCM_GETITEMCOUNT, 0, 0) Local $iCurSel = _SendMessage($hWnd, $TCM_GETCURSEL, 0, 0) ; 3. Prepare the Body Frame (The area beneath the tabs) Local $tFirstTabRect = DllStructCreate($tagRECT) _SendMessage($hWnd, $TCM_GETITEMRECT, 0, DllStructGetPtr($tFirstTabRect)) Local $tBodyRect = DllStructCreate($tagRECT) $tBodyRect.Left = 0 $tBodyRect.Top = $tFirstTabRect.Bottom ; Starts at the bottom edge of the tabs $tBodyRect.Right = $iWidth $tBodyRect.Bottom = $iHeight Local $hBrushBorder = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_RED)) _WinAPI_FrameRect($hMemDC, $tBodyRect, $hBrushBorder) ; 4. Draw the "Gap" to the right of the tabs in GUI background color If $iTabCount > 0 Then Local $tLastTabRect = DllStructCreate($tagRECT) _SendMessage($hWnd, $TCM_GETITEMRECT, $iTabCount - 1, DllStructGetPtr($tLastTabRect)) Local $tGapRect = DllStructCreate($tagRECT) $tGapRect.Left = $tLastTabRect.Right + 2 $tGapRect.Top = 0 $tGapRect.Right = $iWidth $tGapRect.Bottom = $tLastTabRect.Bottom Local $hBrushGui = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_GUI_BG)) _WinAPI_FillRect($hMemDC, $tGapRect, $hBrushGui) _WinAPI_DeleteObject($hBrushGui) EndIf _WinAPI_SetBkMode($hMemDC, 1) ; Transparent background for text ;~ _WinAPI_SetTextColor($hMemDC, _ColorToCOLORREF(0xF0F0F0)) ; 5. Draw individual tabs For $i = 0 To $iTabCount - 1 Local $tRECT = DllStructCreate($tagRECT) _SendMessage($hWnd, $TCM_GETITEMRECT, $i, DllStructGetPtr($tRECT)) If $tRECT.Right < 0 Or $tRECT.Left > $iWidth Then ContinueLoop $tRECT.top -= 2 Local $bSelected = ($i = $iCurSel) Local $iTabColor = $bSelected ? $COLOR_DARKSLATEGRAY : $COLOR_BG_DARK Local $hTabBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($iTabColor)) ; Fill tab background _WinAPI_FillRect($hMemDC, $tRECT, $hTabBrush) If $bSelected Then _WinAPI_SetTextColor($hMemDC, _WinAPI_SwitchColor($COLOR_VIOLET)) ; Draw border ONLY for the active tab (Top, Left, Right) _WinAPI_FrameRect($hMemDC, $tRECT, $hBrushBorder) ; OPEN BOTTOM: Draw a line in tab-color over the body-border to merge them Local $tOpenLine = DllStructCreate($tagRECT) $tOpenLine.Left = $tRECT.Left + 1 $tOpenLine.Top = $tRECT.Bottom - 1 ; Exactly on the border line of the body $tOpenLine.Right = $tRECT.Right - 1 $tOpenLine.Bottom = $tRECT.Bottom + 1 _WinAPI_FillRect($hMemDC, $tOpenLine, $hTabBrush) Else _WinAPI_SetTextColor($hMemDC, _WinAPI_SwitchColor($COLOR_RED)) ; Draw rectangle around non active tabs Local $hBrushTabRecDark = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($COLOR_BORDER_DARK)) _WinAPI_FrameRect($hMemDC, $tRECT, $hBrushTabRecDark) _WinAPI_DeleteObject($hBrushTabRecDark) EndIf _WinAPI_DeleteObject($hTabBrush) ; Draw text centered Local $sText = _GUICtrlTab_GetItemText($hWnd, $i) Local $tTextRect = DllStructCreate($tagRECT) With $tTextRect .Left = $tRECT.Left + 6 .Top = $tRECT.Top + ($bSelected ? 1 : 3) .Right = $tRECT.Right - 6 .Bottom = $tRECT.Bottom - 3 EndWith DllCall("user32.dll", "int", "DrawTextW", "handle", $hMemDC, "wstr", $sText, "int", -1, "struct*", $tTextRect, "uint", BitOR($DT_CENTER, $DT_VCENTER, $DT_SINGLELINE, $DT_NOPREFIX)) Next ; 6. Copy memory DC to screen DC (BitBlt) _WinAPI_BitBlt($hDC, 0, 0, $iWidth, $iHeight, $hMemDC, 0, 0, $SRCCOPY) ; Cleanup _WinAPI_SelectObject($hMemDC, $hOldBmp) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hBrushBg) _WinAPI_DeleteObject($hBrushBorder) _WinAPI_DeleteDC($hMemDC) _WinAPI_EndPaint($hWnd, $tPaint) Return 0 EndSwitch Return _WinAPI_CallWindowProc($g_hProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func _ColorToCOLORREF($iColor) ; Convert 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 Func Min($a, $b) Return ($a < $b ? $a : $b) EndFunc ;==>Min Func Max($a, $b) Return ($a > $b ? $a : $b) EndFunc ;==>Max 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