Jump to content

Recommended Posts

Posted

I have run into some issues with what I am attempting to do with the GUIFrame UDF. One of them might be a bug or something that could be improved possibly. By the way, this is not related to the WS_EX_COMPOSITED changes that we were discussing earlier.

The two examples that I am providing are designed to work with the original GUIFrame.au3 UDF (not the beta GUIFrame_WBD_Mod.au3 version).

Diagram of what I am attempting to do:

Spoiler
┌──────────────────────────────────────────────────────┐
│                                                      │
│          (1)                                         │
│                                                      │
┼────────────────┬─────────────────────────────────────┤
│                │                                     │
│                │                                     │
│                │                                     │
│                │                                     │
│                │                                     │
│                │                                     │
│                │                                     │
│      (2)       │                (3)                  │
│                │                                     │
│                │                                     │
│                │                                     │
│                │                                     │
│                │                                     │
│                │                                     │
└────────────────┴─────────────────────────────────────┘
  1. Top area (toolbar buttons, etc.)
    • Height must remain specific pixels (eg. 100px) when GUI resizes
    • Width can resize accordingly
  2. Left side (treeview)
    • Height and width can resize accordingly
    • Control will dock to all sides and resize
  3. Right side (listview)
    • Height and width can resize accordingly
    • Control will dock to all sides and resize

 

 

The first example is where I believe that there might be a bug. This example uses the _GUIFrame_Create feature that allows you to specify the Y coordinates of where the GUI frame (FrameParent) begins. In this example, I am using the variable $iTopSpace = 60

If you resize the width of the GUI only, you notice that the controls (labels) in the two bottom frames stay at the appropriate ratio. Keep in mind, this would also represent the same whether they are treeview controls or whatever. I just used labels to keep the example simple.

Now, if you resize the GUI height, bigger to smaller, smaller to bigger, etc., you will notice that the controls (labels) in the two bottom frames start to have their ratios significantly impaired. It still happens even if I don't use GUICtrlSetResizing to lock down the label size in the top section.

I feel like there must be something within _GUIFrame_SIZE_Handler that does not take into account the value, in this case $iTopSpace = 60, placed for the Y coordinates in the _GUIFrame_Create  function. I believe that it must be getting the height for the main GUI instead of the main GUI height minus the $iTopSpace = 60 (or whatever value the user puts there).

Example 1:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include "GUIFrame.au3"

; DPI awareness
DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2)

Global $iSep_Pos

$hGUI = GUICreate("GUI_Frame Example", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))

GUISetState(@SW_SHOW, $hGUI)

$iTopSpace = 60
$aGUISize = WinGetClientSize($hGUI)
GUICtrlCreateLabel(" ", 0, 0, $aGUISize[0], $iTopSpace)
GUICtrlSetBkColor(-1, 0x808080)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT)

; Create a 1st level frame
$iFrame_A = _GUIFrame_Create($hGUI, 0, 100, 5, 0, $iTopSpace, 0, 0, 0, 0x02000000)
_GUIFrame_SetMin($iFrame_A, 50, 125, True)  ; This line sets the minima as absolute values <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;_GUIFrame_SetMin($iFrame_A, 50, 125)       ; This line adjusts the minima to equivalent percentages on resizing <<<<<<<<<<<<<<<<<<<<<

_GUIFrame_Switch($iFrame_A, 1)
$aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2))
GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10 - $iTopSpace)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlSetBkColor(-1, 0x00FF00)

_GUIFrame_Switch($iFrame_A, 2)
$aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2))
GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10 - $iTopSpace)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetState(-1, $GUI_DISABLE)

; Set resizing flag for all created frames
_GUIFrame_ResizeSet(0) ; Adjust the second parameter to change the resizing behaviour <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; Register the $WM_SIZE handler to permit resizing
_GUIFrame_ResizeReg()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ; The UDF does all the tidying up as you exit
            Exit
    EndSwitch

WEnd

 

Now for the second example. I had exhausted all of my attempts to get Example 1 to work properly over the course of a few days. So in Example 2, I am attempting to use the built-in GUIFrame UDF features to make the top section an actual frame.

So with this method, all of the mathematics works out perfectly as far as how the controls and everything measures up when resizing the GUI. This seems very promising.

The problem that I am having is getting that top section (frame) to stay at a locked height. For example, let's say that the top frame is 100 pixels, I don't want it to go any smaller or larger than the 100 pixel height. The width can resize, of course.

Resizing the width of the GUI is perfect and no issues there. The issue is when I resize the height of the GUI again. The control (label) measurements all stay proper ratio which is fantastic. But that top frame likes to grow and shrink.

In this example, I don't think that it is a bug. This is likely just me not knowing how to set it properly. Or possibly might be a good feature request if it's not yet possible.

Example 2:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include "GUIFrame.au3"

; DPI awareness
DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2)

$hGUI = GUICreate("GUI_Frame Example #", 500, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetState()

; Create a 1st level frame
$iFrame_A = _GUIFrame_Create($hGUI, 1, 100, 5, 0, 0, 0, 0, 0, 0x02000000)
_GUIFrame_SetMin($iFrame_A, 100, 100)

_GUIFrame_Switch($iFrame_A, 1)

$aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 1))
GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlSetBkColor(-1, 0x00FF00)

; Create a 2nd level frame
$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 0, 100, 5, 0, 0, 0, 0, 0, 0x02000000)
GUISetBkColor(0xCCFFCC, _GUIFrame_GetHandle($iFrame_B, 1))

_GUIFrame_Switch($iFrame_B, 1)

$aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_B, 1))
GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlSetBkColor(-1, 0x0000BB)

_GUIFrame_Switch($iFrame_B, 2)

$aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_B, 2))
GUICtrlCreateLabel("", 5, 5, $aWinSize[0] - 10, $aWinSize[1] - 10)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlSetBkColor(-1, 0x0000BB)

; Set resizing flag for all created frames
_GUIFrame_ResizeSet(1, 1)
_GUIFrame_ResizeSet(2, 0)

; Register the WM_SIZE handler
_GUIFrame_ResizeReg()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ; The UDF does all the tidying up as you exit
            Exit
    EndSwitch

    ; Get resize flags
    ;$aResize = _GUIFrame_ResizeState()
    ; If a frame has been resized then the [0] element = 1
    ;If $aResize[0] Then _Check_Frames($aResize)

WEnd

 

Thank you. :)

  • Moderators
Posted

WildByDesign,

Does this do what you want? Fixed Top Zone.au3  Basically it creates a single frameset 100 pixels down.

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted
1 hour ago, Melba23 said:

Does this do what you want? Fixed Top Zone.au3  Basically it creates a single frameset 100 pixels down.

I appreciate you taking the time to respond, Melba. Thank you. :)

This helps a little bit with subtracting the value of the control height with the value of the top section. It gives me a better understanding of that aspect. However, once you add the resizing with:

_GUIFrame_ResizeSet(0)
_GUIFrame_ResizeReg()

The problem is still there with GUI height resizing. Resizing the GUI width is not an issue.

In my example, when resizing the GUI height, it would show the problem at the top and bottom of the controls that are in the two bottom frames.

With your example, there is an improvement, since the issue is now only present at the top of the controls (no longer an issue at the bottom).

The problem is that those label controls go under the top section when resizing the height of the GUI. They can also end up moving further down as well. But if you can imagine with a TreeView and ListView control in those bottom frames (instead of the labels), what happens is that the header for the ListView goes under the top section and some of the TreeView gets cut off as well.

Posted

I just did some digging. In the WM_SIZE function in GUIFrame.au3 I see:

Func _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
...
        ; Get new base GUI size
        Local $aSize = WinGetClientSize($hWnd)
...

So it pulls the width/height for the client area of the main GUI to do all of the math. I admit that I am terrible at all of the intricate math stuff involved here. However, it would seem that it may not take into consideration the values from:

$iFrame = _GUIFrame_Create($hGUI, 0, 0, 5, hereX, hereY, 0, 0, 0, 0x02000000)

The X and Y values from where FrameParent is positioned initially within that main GUI. So that could cause this problem vertically as I am experiencing but also horizontally if a user puts a value other than 0 for the X position.

  • Moderators
Posted

WildByDesign,

You could well be right - I will look into it.

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

@Melba23 I have a nice fix for you with regards to the separator GUI.

I noticed a few problems when moving the separator:

  • mouse cursor constantly switches from/to resize cursor to normal arrow (over and over)
  • mouse cursor can highlight items on either side of the separator while moving *

* In my example, I have a ListView on both sides. The columns are purposely larger to enable the scrollbars to appear. When you move the separator back and forth, you can see the items in the right ListView get highlighted briefly over and over. And on the left ListView, you can see the scrollbar arrows get triggered briefly each time. And of course, the mouse cursor changes with each of those movements.

The glitches appear in both light mode and dark mode GUI's. However, they are easier to see in dark mode. Therefore, I made the GUI and controls dark mode for the purpose of the example.

By the way, I am using your original GUIFrame UDF but simply passing the composited extended style:

_GUIFrame_Create($hGUI, 0, 0, 5, 0, 0, 0, 0, 0, $WS_EX_COMPOSITED)

Please try my example with your current GUIFrame.au3 UDF (not the beta WS_EX_COMPOSITED one). Drag the separator back and forth a bunch of times at varying speeds to see the visual glitches on both sides of the separator (and cursor changes).

After, try my example with my slightly modified GUIFrame.au3 to see all of those issues fixed.

The only (relevant) changes were added to _GUIFrame_SepWndProc function:

; Get cursor info for the Separator
Local $aCInfo = GUIGetCursorInfo($hSeparator)
...

; Capture mouse within separator while dragging
_WinAPI_SetCapture($hSeparator)

...
; Depending on separator orientation
If $aGF_SettingsIndex[$iIndex][0] = 0 Then

Now, importantly, when the separator stops moving it does need:

_WinAPI_ReleaseCapture()

I have it placed within the While loop in the example script. But that may not be ideal. You understand the UDF the best and you will know where the best place to have the capture release. Essentially when the $hSeparator GUI has stopped moving.

Anyway, this solved my problems perfectly.

EDIT: I forgot to add the modified UDF and example script. Need more coffee. :)

Example:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <WinAPITheme.au3>

#include "GUIFrame.au3"

; DPI awareness
DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2)

; Set Global vars for separator child GUI ($hSeparator) and separator label control ($idSeparator)
; The purpose is just to make it easier to share the handle and CtrlID from the UDF script
Global $hSeparator, $idSeparator
Global $hListView, $hListView2

$hGUI = GUICreate("GUI_Frame Example", 800, 600, -1, -1, -1)
GUISetState()

; Create a 1st level frame
$iFrame_A = _GUIFrame_Create($hGUI, 0, 0, 5, 0, 0, 0, 0, 0, $WS_EX_COMPOSITED)
_GUIFrame_SetMin($iFrame_A, 50, 125, True)  ; This line sets the minima as absolute values <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

_GUIFrame_Switch($iFrame_A, 1)
$aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 1))
Local $idListview = GUICtrlCreateListView("col1  |col2|col3  ", 0, 0, $aWinSize[0], $aWinSize[1], BitOR($LVS_SHOWSELALWAYS, $LVS_NOCOLUMNHEADER), $LVS_EX_FULLROWSELECT)
$hListView = GUICtrlGetHandle($idListview)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
_WinAPI_SetWindowTheme(GUICtrlGetHandle($idListview), 'Explorer')
_GUICtrlListView_BeginUpdate($idListview)
For $i = 0 To 40
    _GUICtrlListView_AddItem( $idListview, "item" & $i & "-000000000Z", -1)
    For $j = 1 To 4
        _GUICtrlListView_AddSubItem($idListview, $i, "row" & $i & "-" & "col" & $j, $j)
    Next
Next
_GUICtrlListView_EndUpdate($idListview)
_GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($idListview), 0, 300)
_GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($idListview), 1, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($idListview), 2, $LVSCW_AUTOSIZE)

_GUIFrame_Switch($iFrame_A, 2)
$aWinSize2 = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2))
Local $idListview2 = GUICtrlCreateListView("col1  |col2|col3  ", 0, 0, $aWinSize2[0], $aWinSize2[1], BitOR($LVS_SHOWSELALWAYS, $LVS_NOCOLUMNHEADER), $LVS_EX_FULLROWSELECT)
$hListView2 = GUICtrlGetHandle($idListview2)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
_WinAPI_SetWindowTheme(GUICtrlGetHandle($idListview2), 'Explorer')
_GUICtrlListView_BeginUpdate($idListview2)
For $i = 0 To 40
    _GUICtrlListView_AddItem( $idListview2, "item" & $i & "-000000000Z", -1)
    For $j = 1 To 4
        _GUICtrlListView_AddSubItem($idListview2, $i, "row" & $i & "-" & "col" & $j, $j)
    Next
Next
_GUICtrlListView_EndUpdate($idListview2)
_GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($idListview2), 0, 200)

GUICtrlSendMsg($idListview, $WM_CHANGEUISTATE, 65537, 0)
GUICtrlSendMsg($idListview2, $WM_CHANGEUISTATE, 65537, 0)

ConsoleWrite("Separator WS_CHILD Handle : " & $hSeparator & @CRLF)
ConsoleWrite("Separator Label Handle : " & GUICtrlGetHandle($idSeparator) & @CRLF)
ConsoleWrite("Separator Label CtrlID : " & $idSeparator & @CRLF)

DarkMode($hGUI, True)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ; The UDF does all the tidying up as you exit
            Exit
        Case $idSeparator ; separator label control
            ConsoleWrite("Separator has finished moving." & @CRLF)
            ; this can be used to reestablish normal cursor stuff
            ;_MouseTrap()
            _WinAPI_ReleaseCapture()
    EndSwitch

WEnd

;--------------------------------------------------------------------------------------------------------------------------------
; https://www.autoitscript.com/forum/topic/211475-darkmode-udf-for-autoits-win32guis/#comment-1530103
;--------------------------------------------------------------------------------------------------------------------------------
Func DarkMode($hGUI, $bDarkMode = True)                               ; DarkMode

    Local Enum $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20
    ;ConsoleWrite("$DWMWA_USE_IMMERSIVE_DARK_MODE=" & $DWMWA_USE_IMMERSIVE_DARK_MODE & @CRLF)
    ;       DWMWA_USE_IMMERSIVE_DARK_MODE ; https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
    ;       Use with DwmSetWindowAttribute. Allows the window frame for this window to be drawn in dark mode colors when the dark mode system setting is enabled.
    ;       For compatibility reasons, all windows default to light mode regardless of the system setting.
    ;       The pvAttribute parameter points to a value of type BOOL. TRUE to honor dark mode for the window, FALSE to always use light mode.
    ;       This value is supported starting with Windows 11 Build 22000.

    Local $iRet = _WinAPI_DwmSetWindowAttribute_unr($hGUI, $DWMWA_USE_IMMERSIVE_DARK_MODE, $bDarkMode)
    If Not $iRet Then Return SetError(1, 0, -1)

    _SetCtrlColorMode($hGUI, $bDarkMode)
    _SetCtrlColorMode(GUICtrlGetHandle($idListview), $bDarkMode)
    _SetCtrlColorMode(GUICtrlGetHandle($idListview2), $bDarkMode)
    GUICtrlSetColor($idListview, 0xFFFFFF)
    GUICtrlSetColor($idListview2, 0xFFFFFF)
    GUICtrlSetBkColor($idListview, 0x202020)
    GUICtrlSetBkColor($idListview2, 0x202020)

EndFunc   ;==>DarkMode
;--------------------------------------------------------------------------------------------------------------------------------
Func _SetCtrlColorMode($hWnd, $bDarkMode = True, $sName = Default)    ; 'Explorer', 'CFD', 'DarkMode_ItemsView', etc.
    If $sName = Default Then $sName = $bDarkMode ? 'DarkMode_Explorer' : 'Explorer'
    $bDarkMode = Not Not $bDarkMode ; https://www.vbforums.com/showthread.php?900444-Windows-10-Dark-Mode-amp-VB6-apps
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local Enum $eDefault, $eAllowDark, $eForceDark, $eForceLight, $eMax ; enum PreferredAppMode
    DllCall('uxtheme.dll', 'bool', 133, 'hwnd', $hWnd, 'bool', $bDarkMode) ; fnAllowDarkModeForWindow = 133
    DllCall('uxtheme.dll', 'int', 135, 'int', ($bDarkMode ? $eForceDark : $eForceLight)) ; fnAllowDarkModeForApp = 135
    _WinAPI_SetWindowTheme_unr($hWnd, $sName) ; https://www.autoitscript.com/forum/index.php?showtopic=211475&view=findpost&p=1530103
    DllCall('uxtheme.dll', 'none', 104) ; fnRefreshImmersiveColorPolicyState = 104  ; not needed ?
    _SendMessage($hWnd, $WM_THEMECHANGED, 0, 0) ; not needed ?
EndFunc   ;==>_SetCtrlColorMode
;--------------------------------------------------------------------------------------------------------------------------------
Func _WinAPI_SetWindowTheme_unr($hWnd, $sName = Null, $sList = Null)  ; #include <WinAPITheme.au3> ; unthoughtful unrestricting mod.
    ;Causes a window to use a different set of visual style information than its class normally uses
    Local $sResult = DllCall('UxTheme.dll', 'long', 'SetWindowTheme', 'hwnd', $hWnd, 'wstr', $sName, 'wstr', $sList)
    If @error Then Return SetError(@error, @extended, 0)
    If $sResult[0] Then Return SetError(10, $sResult[0], 0)
    Return 1
EndFunc   ;==>_WinAPI_SetWindowTheme_unr
;--------------------------------------------------------------------------------------------------------------------------------
Func _WinAPI_DwmSetWindowAttribute_unr($hWnd, $iAttribute, $iData)    ; #include <WinAPIGdi.au3> ; unthoughtful unrestricting mod.
    ;Sets the value of the specified attributes for non-client rendering to apply to the window
    Local $aCall = DllCall('dwmapi.dll', 'long', 'DwmSetWindowAttribute', 'hwnd', $hWnd, 'dword', $iAttribute, _
            'dword*', $iData, 'dword', 4)
    If @error Then Return SetError(@error, @extended, 0)
    If $aCall[0] Then Return SetError(10, $aCall[0], 0)
    Return 1
EndFunc   ;==>_WinAPI_DwmSetWindowAttribute_unr
;--------------------------------------------------------------------------------------------------------------------------------

 

GUIFrame.au3

Edited by WildByDesign
forgot to add modified UDF and example
Posted
On 12/21/2025 at 7:50 AM, WildByDesign said:

I have it placed within the While loop in the example script. But that may not be ideal. You understand the UDF the best and you will know where the best place to have the capture release. Essentially when the $hSeparator GUI has stopped moving.

I ended up finding the appropriate place to release the capture within the UDF. This way the _WinAPI_SetCapture and _WinAPI_ReleaseCapture are all contained within the UDF and function beautifully.

; Do until the mouse button is released
Until Not _WinAPI_GetAsyncKeyState(0x01)
...
; release mouse capture after separator has stopped moving
_WinAPI_ReleaseCapture()
...
ElseIf $aGF_SettingsIndex[$iIndex][0] = 1 Then
...
Until Not _WinAPI_GetAsyncKeyState(0x01)
...
; release mouse capture after separator has stopped moving
_WinAPI_ReleaseCapture()

Basically after the two calls to _WinAPI_GetAsyncKeyState which indicates that the separator has stopped moving.

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...