-
Posts
7,521 -
Joined
-
Last visited
-
Days Won
95
UEZ last won the day on April 2
UEZ had the most liked content!
About UEZ

- Birthday 12/03/2007
Profile Information
-
Member Title
Never say never
-
Location
Germany
-
Interests
Computer, watching movies, football (soccer), being lazy :-)
UEZ's Achievements
-
argumentum reacted to a post in a topic:
Pic control resize issue
-
With resize I mean really resize of the grid. My example above fills only the grid but doesn't resize it. You can also resize the grid when GUI resizes. That means the grid becomes smaller / bigger on GUI resize.
-
Is the grid just for demonstration purposes, or is that really the background you want to use? Should the grid resize when the GUI is resized? Here the version without resizing the grid on GUI resize (modified one of my old scripts): ;Coded by UEZ build 2026-05-31 #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $STM_SETIMAGE = 0x0172 Global $sImage = "Grid.png" _GDIPlus_Startup() Global $hBmp = _GDIPlus_BitmapCreateFromFile($sImage), $hTexture = _GDIPlus_TextureCreate($hBmp, 0) Global $iW = _GDIPlus_ImageGetWidth($hBmp), $iH = _GDIPlus_ImageGetHeight($hBmp) Global $hGUI = GUICreate("Test", $iW, $iH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME), $WS_EX_COMPOSITED) Global $idPic = GUICtrlCreatePic("", 0, 0, $iW, $iH) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) Global $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) Global $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap) If $hB Then _WinAPI_DeleteObject($hB) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_SIZE, "") _WinAPI_DeleteObject($hHBitmap) _GDIPlus_BrushDispose($hTexture) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_Shutdown() GUIDelete() Exit EndSwitch WEnd Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam Local $aSize = ControlGetPos($hWnd, "", $idPic) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($aSize[2], $aSize[3]) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetInterpolationMode($hContext, 0) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $aSize[2], $aSize[3], $hTexture) _GDIPlus_GraphicsDispose($hContext) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) Local $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap) If $hB Then _WinAPI_DeleteObject($hB) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_BitmapDispose($hBitmap) Return "GUI_RUNDEFMSG" EndFunc
-
robertocm reacted to a post in a topic:
Using GDI+, how can you destory the image?
-
UEZ reacted to a post in a topic:
UC_Framework - Universal Controls
-
I found the bug: I changed from CoInitializeEx(NULL, COINIT_MULTITHREADED) to CoInitializeEx(NULL, COINIT_APARTMENTTHREADED). WGC (Windows.Graphics.Capture) is based on WinRT, and WinRT objects are fundamentally designed for MTA. Bug should be fixed know.
-
Sorry, there is a nasty bug in 0.7.7.0 -> when you start, stop and start again it crashes... 🤔
-
wakillon reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
wakillon reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
Thanks for the complete set of logs! Here's the full picture across all four configurations: All recordings have the correct duration — no more drift, the file matches real time in every case. 4K @ 30 fps with High 4:4:4 is the best setting for your system — lowest drop rate (23%) and almost no duplicated frames (7%). This gives you the cleanest capture. Interestingly, switching to High 4:2:0 doesn't help — it actually increases drops and dupes. That's because 4:2:0 forces an extra color conversion step (BGRA→YUV) inside x264 which costs additional CPU time, while 4:4:4 takes the raw pixel data directly with no conversion overhead. 4K @ 60 fps stays limited to ~30 real frames per second regardless of profile — this is a WGC API throughput ceiling on your hardware, not something AirCapRec can work around. Good catch — it's counterintuitive but makes sense once you look at the logs: At 60 fps, about 60% of your frames are duplicates (WGC only delivers ~30 real frames per second). x264 is very efficient at encoding duplicate frames — a P-frame that says "nothing changed" costs almost zero bytes. So 60 fps = lots of near-free frames. At 30 fps, nearly every frame is a unique capture with real pixel changes. Each frame needs significantly more bits to encode. So 30 fps = fewer frames but each one is expensive. Result: 30 fps × high bits per frame > 60 fps × many near-zero-cost duplicates. This is actually a sign that things work correctly! Regarding saving settings on exit — good idea, it's on the list for a future version.
-
Hmm, I think you used “High 4:2:0” (which is now the default setting), which converts the RGB colors to YUV colors when recording in 4K resolution. This uses too much CPU which drops a lot of frames. Was the FPS most time below 60 FPS when you look at the GUI which shows the current FPS / destination FPS. There should be a difference if you record in "High 4:4:4" at 4K @ 60 FPS. Can you test it please? How is “High 4:2:0” in 4K @ 30 FPS? I updated several times the Zip archive and in of the version I didn't use performance compiler setting. If the Exe is less than 410.000 bytes than you have the default compiled version. Merci. Edit: I tested “High 4:2:0” at 60 FPS in full HD and recorded 30 seconds. No problems and properly played in VLC, MPC-BE, Windows Media Player Legacy. Unfortunately, no other users are currently participating in the testing. 😞 Edit2: seems not to change to "High 4:4:4" when selected. Edit3: High 4:2:0 was hard coded -> fixed now. Edit4: new version uploaded -> frames will be duplicated when CPU is too slow.
-
Also the region? I've added support for the YUV color space (now the default), which does use a bit more CPU power, but this should allow older versions of Windows Media Player to play the files, and the MP4 file should also be a little smaller. I don't know how 4K @ 60 FPS recording works with YUV, or if there are a lot of frame drops. Thanks again for testing. 👍
-
UEZ reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
wakillon reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
Davidyese reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
Davidyese reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
Davidyese reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
@wakillon I think I fixed the DPI issues which caused that you can't see the About window and the region selection. For region: it was set to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 and for me it works propely. Obvously your Windows version doesn't support it - added some fallbacks. I uploaded a new build -> AirCapRec (link is the same). Can you please test again?
-
wakillon reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
UEZ reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
What a shame that it's not showing up on your screen. It is the About Window with some raymarched animation and a simple vertical scroller. The About window video: About AirCapRec Window I need to check. Unfortunatelly I don't have a 4k monitor to test with 300% DPI. It takes up a lot of CPU time if you have to reduce the resolution while recording. I'm currently working on another DLL to re-encode the recorded mp4 file afterward and make it smaller. Let me analyze your log.... Thank you so much, again and again, for testing the app. I really appreciate it. 👍 Latest version on my OneDrive: AirCapRec which from today. 😉
-
Danyfirex reacted to a post in a topic:
Testing fullscreen video capturing @ 60 FPS
-
Hi everyone, I’ve updated my video recording tool, now named AirCapRec (v0.7.5). I need help testing technical edge cases where manual stride handling often fails. Seeking feedback on: "Weird" Resolutions: Any skewed/slanted images on ultra-wide or non-standard window sizes? High-DPI / Multi-Monitor: Does the capture area and cursor align correctly at 125% or 150% scaling? Stability: Any frame drops or stutter during long sessions? Download: AirCapRec.zip If you find a bug, please post your Resolution, DPI Scaling, and Windows Version. You can also enable the Debug Log option in the settings to provide more information. Thanks for the support!
-
UEZ reacted to a post in a topic:
GUIDarkTheme UDF
-
Here the modification of the test script: ; 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) Example() Func Example() Local $hGUI = GUICreate("Colored Tab", 400, 300) GUISetBkColor(0x404040) GUISetFont(10, 300) ;Local $idTab = GUICtrlCreateTab(20, 20, 360, 260, -1, $WS_EX_COMPOSITED) Local $idTab = GUICtrlCreateTab(20, 20, 360, 260, -1) Local $hTab = GUICtrlGetHandle($idTab) GUICtrlCreateTabItem("tab0") GUICtrlCreateLabel("label0", 30, 80, 50, 20) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateTabItem("tab----1") GUICtrlCreateLabel("label1", 30, 80, 50, 20) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateTabItem("tab2") GUICtrlSetState(-1, $GUI_SHOW) GUICtrlCreateLabel("label2", 30, 80, 50, 20) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateTabItem("tab3") GUICtrlCreateLabel("label3", 30, 80, 50, 20) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlCreateTabItem("tab4") GUICtrlCreateTabItem("tab5") GUICtrlCreateTabItem("tab6") GUICtrlCreateTabItem("") ; 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(WM_PAINT, "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) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_RemoveWindowSubclass($hTab, DllCallbackGetPtr($hSubclass), $idTab) DllCallbackFree($hSubclass) EndFunc ;==>Example Func WM_PAINT($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 $tRect = _WinAPI_GetClientRect($hWnd) Local $iW = $tRect.Right Local $iH = $tRect.Bottom Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap) _SendMessage($hWnd, $WM_PRINTCLIENT, $hMemDC, 20) ; 20 = $PRF_CLIENT or $PRF_CHILDREN Local $hBrush = _WinAPI_CreateSolidBrush(0x404040) Local $iTabCount = _GUICtrlTab_GetItemCount($hWnd) If $iTabCount > 0 Then Local $tRectLast = _GUICtrlTab_GetItemRectEx($hWnd, $iTabCount - 1) ; exclude UpDown control from being painted over - ExcludeClipRect code from UEZ Local $hTabUpDown = _WinAPI_FindWindowEx($hWnd, "msctls_updown32") If $hTabUpDown And _WinAPI_IsWindowVisible($hTabUpDown) Then Local $tCR = _WinAPI_GetWindowRect($hTabUpDown) Local $tPR = _WinAPI_GetWindowRect($hWnd) DllCall('gdi32.dll', "int", "ExcludeClipRect", "handle", $hMemDC, _ "int", $tCR.Left - $tPR.Left, "int", $tCR.Top - $tPR.Top, _ "int", $tCR.Right - $tPR.Left, "int", $tCR.Bottom - $tPR.Top) EndIf ; paints area to the right of all tabs Local $tPatch = DllStructCreate($tagRECT) $tPatch.Left = $tRectLast.Right - 2 $tPatch.Top = 0 $tPatch.Right = $iW $tPatch.Bottom = $tRectLast.Bottom _WinAPI_FillRect($hMemDC, $tPatch, $hBrush) ; paints area to the left of all tabs $tPatch.Left = 0 $tPatch.Right = 2 _WinAPI_FillRect($hMemDC, $tPatch, $hBrush) ; paints strip on top of each tab $tPatch.Left = 0 $tPatch.Top = 0 $tPatch.Right = $iW $tPatch.Bottom = 2 _WinAPI_FillRect($hMemDC, $tPatch, $hBrush) EndIf _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) Return 0 EndSwitch Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>WM_PAINT 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
-
Took the code from my example and modified it: #include <WindowsNotifsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPITheme.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <TabConstants.au3> #include <GuiTab.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_BORDER)) _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_BUTTON_BG : $COLOR_BG_DARK Local $hTabBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF($iTabColor)) ; Fill tab background _WinAPI_FillRect($hMemDC, $tRECT, $hTabBrush) If $bSelected Then ; 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 ; 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 Does it help or do you insist of your test script?