Jump to content

Recommended Posts

  • Moderators
Posted

Beege,

retrieve or calculate the current position of the separator

No problem to do this with a small UDF function _GUIFrame_GetSepPos - all the values required are already stored within the UDF. :(

New UDF:

#include-once
; #INDEX# ============================================================================================================
; Title .........: GUIFrame
; AutoIt Version : 3.3 +
; Language ......: English
; Description ...: Splits GUI into slideable and resizable 2 part frames
; Remarks .......: - The user must call _GUIFrame_Exit on exit to delete subclassed separator bars to the
;                  UDF created WndProc and to release the Callback.
;                  - Only 2 levels of frames supported
;                  - If the script already has a WM_SIZE handler then do NOT use _GUIFrame_ResizeReg, but call
;                  _GUIFrame_SIZE_Handler from within it
; Author ........: Original UDF by Kip
; Modified ......; This version by Melba23
; ====================================================================================================================

;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

; #INCLUDES# =========================================================================================================
#include <WinAPI.au3>

; #GLOBAL VARIABLES# =================================================================================================

; Array to hold handles for each frame set
Global $aGF_HandleIndex[1][7]
; [0][0] = 0 ; Count of frames      [0][1] = Move registered flag
; [n][0] = Parent GUI handle        [n][4] = Original GUI handle
; [n][1] = First frame handle       [n][5] = Indices of first frame internal frames
; [n][2] = Second frame handle      [n][6] = Indices of second frame internal frames
; [n][3] = Separator bar handle

; Array to hold sizing percentages for each frame set
Global $aGF_SizingIndex[1][6]
; [n][0] = First frame min      [n][2] = X coord    [n][4] = Width
; [n][1] = Second frame min     [n][3] = Y coord    [n][5] = Height

; Array to hold other settings for each frame set
Global $aGF_SettingsIndex[1][3]
; [n][0] = Separator orientation (vert/horz = 0/1)
; [n][1] = Resizable frame flag (0/1)
; [n][2] = Separator size (default = 5)

; Array to hold WinProc handles for each separator
Global $aGF_SepProcIndex[1][2] = [[0, 0]]

; Store registered Callback handle
Global $hGF_RegCallBack = DllCallbackRegister("_GUIFrame_SepWndProc", "int", "hwnd;uint;wparam;lparam")
$aGF_SepProcIndex[0][1] = DllCallbackGetPtr($hGF_RegCallBack)

; #CURRENT# ==========================================================================================================
; _GUIFrame_Create:       Splits a GUI into 2 frames
; _GUIFrame_SetMin:       Sets minimum sizes for frames
; _GUIFrame_ResizeSet:    Sets resizing flag for all or specified frames
; _GUIFrame_ResizeReg:    Registers WM_SIZE mesasge for resizing
; _GUIFrame_SIZE_Handler: Resizes frames when a top-level GUI is resized
; _GUIFrame_GetHandle:    Returns the handle of a frame element (required for further splitting)
; _GUIFrame_Switch:       Sets a frame element as current GUI
; _GUIFrame_GetSepPos:    Returns the current position of the separator
; _GUIFrame_Exit:         Deletes all subclassed separator bars to free UDF WndProc and frees registered callback handle
; ====================================================================================================================

; #INTERNAL_USE_ONLY#=================================================================================================
; _GUIFrame_SepSubClass:   Sets new WndProc for frame separator bar
; _GUIFrame_SepWndProc:    New WndProc for frame separator bar
; _GUIFrame_SepPassMsg:    Passes Msg to original WndProc for action
; _GUIFrame_Move:          Moves and resizes frame elements and separator bars
; _GUIFrame_AdjIntFrames:  Moves and resizes internal frame elements when parent frame is resized
; ====================================================================================================================

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_Create
; Description ...: Splits a GUI into 2 frames
; Syntax.........: _GUIFrame_Create($hWnd, $iSepOrient = 0, $iSepPos = 0, $iSepSize = 5, $iX = 0, $iY = 0, $iWidth = 0, $iHeight = 0, $iStyle = 0, $iExStyle = 0)
; Parameters ....: $hWnd - Handle of GUI to split
;                  $iSepOrient - Orientation of separator bar: 0 = Vertical (default), 1 = Horizontal
;                  $iSepPos - Required initial position of separator (default = centre of frame GUI)
;                  $iSepSize - Size of separator bar (default = 5, min = 3, max = 9)
;                  $iX - Left of frame area (default = 0)
;                  $iY - Top of frame area (default = 0)
;                  $iWidth - Width of frame area (default = full width)
;                  $iHeight - Height of frame area (default = full height)
;                  SiStyle - Required style value for frame elements
;                  SiExStyle - Required extended style value for frame elements
; Requirement(s).: v3.3 +
; Return values .: Success:  Returns index number of frame/separator set
;                  Failure:  Returns 0 and sets @error as follows:
;                  1 = Child limit exceeded
;                  2 = GUI creation failed
;                  2 = Separator subclassing failed
; Author ........: Kip
; Modified ......: Melba23
; Remarks .......: - The user must call _GUIFrame_Exit on exit to delete subclassed separator bars to free the
;                  UDF created WndProc and to release the registered Callback.
;                  - Only 1 level of child frames is supported
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_Create($hWnd, $iSepOrient = 0, $iSepPos = 0, $iSepSize = 5, $iX = 0, $iY = 0, $iOrg_Width = 0, $iOrg_Height = 0, $iStyle = 0, $iExStyle = 0)

    Local $iSeperator_Pos, $hSeparator, $hFirstFrame, $hSecondFrame

    ; Check we are not creating a 3rd level frame
    For $i = $aGF_HandleIndex[0][0] To 1 Step -1
        ; Check previous frames
        If $aGF_HandleIndex[$i][1] = $hWnd Or $aGF_HandleIndex[$i][2] = $hWnd Then
            ; Now see if these frames have a parent
            For $j = 1 To $aGF_HandleIndex[0][0]
                ; If so return
                If $aGF_HandleIndex[$j][1] = $hWnd Or $aGF_HandleIndex[$j][2] = $hWnd Then
                    If $j <> 1 Then Return SetError(1, 0, 0)
                EndIf
            Next
        EndIf
    Next

    ; Set separator size
    Local $iSeparatorSize = 5
    Switch $iSepSize
        Case 3 To 9
            $iSeparatorSize = $iSepSize
    EndSwitch

    ; Set default sizing if no parameters set
    Local $iWidth = $iOrg_Width
    Local $iHeight = $iOrg_Height
    Local $aFullSize = WinGetClientSize($hWnd)
    If Not $iOrg_Width Then $iWidth = $aFullSize[0]
    If Not $iOrg_Height Then $iHeight = $aFullSize[1]

    ; Create parent GUI within client area
    Local $hParent = GUICreate("FrameParent", $iWidth, $iHeight, $iX, $iY, BitOR(0x40000000, $iStyle), $iExStyle, $hWnd) ; $WS_CHILD
    GUISetState(@SW_SHOW, $hParent)

    ; Confirm size of frame parent client area
    Local $aSize = WinGetClientSize($hParent)
    $iWidth = $aSize[0]
    $iHeight = $aSize[1]

    If $iSepOrient = 0 Then

        ; Set initial separator position
        $iSeperator_Pos = $iSepPos
        ; Adjust position if not within GUI or default set (=0)
        If $iSepPos > $iWidth Or $iSepPos < 1 Then
            $iSeperator_Pos = Round(($iWidth / 2) - ($iSeparatorSize / 2))
        EndIf
        ; Create separator bar and force cursor change over separator
        $hSeparator = GUICreate("", $iSeparatorSize, $iHeight, $iSeperator_Pos, 0, 0x40000000, -1, $hParent) ;$WS_CHILD
        GUICtrlCreateLabel("", 0, 0, $iSeparatorSize, $iHeight, -1, 0x00000001) ; $WS_EX_DLGMODALFRAME
        GUICtrlSetCursor(-1, 13)
        GUISetState(@SW_SHOW, $hSeparator)
        ; Create the sizable frames
        $hFirstFrame = GUICreate("", $iSeperator_Pos, $iHeight, 0, 0, 0x40000000, -1, $hParent) ;$WS_CHILD
        GUISetState(@SW_SHOW, $hFirstFrame)
        $hSecondFrame = GUICreate("", $iWidth - ($iSeperator_Pos + $iSeparatorSize), $iHeight, $iSeperator_Pos + $iSeparatorSize, 0, 0x40000000, -1, $hParent) ;$WS_CHILD
        GUISetState(@SW_SHOW, $hSecondFrame)

    Else

        $iSeperator_Pos = $iSepPos
        If $iSepPos > $iHeight Or $iSepPos < 1 Then
            $iSeperator_Pos = Round(($iHeight / 2) - ($iSeparatorSize / 2))
        EndIf
        $hSeparator = GUICreate("", $iWidth, $iSeparatorSize, 0, $iSeperator_Pos, 0x40000000, -1, $hParent) ;$WS_CHILD
        GUICtrlCreateLabel("", 0, 0, $iWidth, $iSeparatorSize, -1, 0x01) ; $WS_EX_DLGMODALFRAME
        GUICtrlSetCursor(-1, 11)
        GUISetState(@SW_SHOW, $hSeparator)
        $hFirstFrame = GUICreate("", $iWidth, $iSeperator_Pos, 0, 0, 0x40000000, -1, $hParent) ;$WS_CHILD
        GUISetState(@SW_SHOW, $hFirstFrame)
        $hSecondFrame = GUICreate("", $iWidth, $iHeight - ($iSeperator_Pos + $iSeparatorSize), 0, $iSeperator_Pos + $iSeparatorSize, 0x40000000, -1, $hParent) ;$WS_CHILD
        GUISetState(@SW_SHOW, $hSecondFrame)

    EndIf

    ; Check for error creating GUIs
    If $hParent = 0 Or $hSeparator = 0 Or $hFirstFrame = 0 Or $hSecondFrame = 0 Then
        ; Delete all GUIs and return error
        GUICreate($hParent)
        GUIDelete($hSeparator)
        GUIDelete($hFirstFrame)
        GUICreate($hSecondFrame)
        Return SetError(2, 0, 0)
    EndIf

    ; Subclass the separator
    If _GUIFrame_SepSubClass($hSeparator) = 0 Then
        ; If Subclassing failed then delete all GUIs and return error
        GUICreate($hParent)
        GUIDelete($hSeparator)
        GUIDelete($hFirstFrame)
        GUICreate($hSecondFrame)
        Return SetError(3, 0, 0)
    EndIf

    ; Create a new line in the arrays
    Local $iIndex = $aGF_HandleIndex[0][0] + 1
    ReDim $aGF_HandleIndex[$iIndex + 1][7]
    ReDim $aGF_SizingIndex[$iIndex + 1][6]
    ReDim $aGF_SettingsIndex[$iIndex + 1][3]

    ; Store this frame set variables/defaults in the new lines
    $aGF_HandleIndex[0][0] = $iIndex
    $aGF_HandleIndex[$iIndex][0] = $hParent
    $aGF_HandleIndex[$iIndex][1] = $hFirstFrame
    $aGF_HandleIndex[$iIndex][2] = $hSecondFrame
    $aGF_HandleIndex[$iIndex][3] = $hSeparator
    $aGF_HandleIndex[$iIndex][5] = 0
    $aGF_HandleIndex[$iIndex][6] = 0
    $aGF_SizingIndex[$iIndex][0] = 0
    $aGF_SizingIndex[$iIndex][1] = 0
    $aGF_SettingsIndex[$iIndex][0] = $iSepOrient
    $aGF_SettingsIndex[$iIndex][1] = 0
    $aGF_SettingsIndex[$iIndex][2] = $iSeparatorSize

    ; Store this frame index in parent line if parent is an existing frame
    For $i = 1 To $aGF_HandleIndex[0][0] - 1
        If $aGF_HandleIndex[$i][1] = $hWnd Then
            If $aGF_HandleIndex[$i][5] = 0 Then
                $aGF_HandleIndex[$i][5] = $iIndex
            Else
                $aGF_HandleIndex[$i][5] &= "|" & $iIndex
            EndIf
            ExitLoop
        EndIf
        If $aGF_HandleIndex[$i][2] = $hWnd Then
            If $aGF_HandleIndex[$i][6] = 0 Then
                $aGF_HandleIndex[$i][6] = $iIndex
            Else
                $aGF_HandleIndex[$i][6] &= "|" & $iIndex
            EndIf
            ExitLoop
        EndIf
    Next

    ; If neither index set, it is a base level GUI so store it
    If $aGF_HandleIndex[$i][5] + $aGF_HandleIndex[$i][6] = 0 Then $aGF_HandleIndex[$iIndex][4] = $hWnd

    ; Store coordinate and size fractions
    If $iX Then
        $aGF_SizingIndex[$iIndex][2] = $iX / $aFullSize[0]
    Else
        $aGF_SizingIndex[$iIndex][2] = 0
    EndIf
    If $iY Then
        $aGF_SizingIndex[$iIndex][3] = $iY / $aFullSize[1]
    Else
        $aGF_SizingIndex[$iIndex][3] = 0
    EndIf
    If $iOrg_Width Then
        $aGF_SizingIndex[$iIndex][4] = $iOrg_Width / $aFullSize[0]
    Else
        $aGF_SizingIndex[$iIndex][4] = 1
    EndIf
    If $iOrg_Height Then
        $aGF_SizingIndex[$iIndex][5] = $iOrg_Height / $aFullSize[1]
    Else
        $aGF_SizingIndex[$iIndex][5] = 1
    EndIf

    ; Switch back to main GUI
    GUISwitch($hWnd)

    ; Return the index for this frame
    Return $iIndex

EndFunc   ;==>_GUIFrame_Create

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_SetMin
; Description ...: Sets minimum sizes for frames
; Syntax.........: _GUIFrame_SetMin($iFrame, $iFirstMin = 0, $iSecondMin = 0)
; Parameters ....: $iFrame - Index of frame set as returned by _GUIFrame_Create
;                  $iFirstMin - Min size of first (left/top) frame - max half size
;                  $iSecondMin - Min Size of second (right/bottom) frame - max half size
; Requirement(s).: v3.3 +
; Return values .: None
; Author ........: Melba23 based on some original code by Kip
; Modified ......:
; Remarks .......: If the frame is resized, these minima are adjusted accordingly
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_SetMin($iFrame, $iFirstMin = 0, $iSecondMin = 0)

    ; Check for valid frame index
    If $iFrame < 1 Or $iFrame > $aGF_HandleIndex[0][0] Then Return 0
    ; Get size of parent
    Local $aSize = WinGetClientSize($aGF_HandleIndex[$iFrame][0])
    ; Now check orientation and determine
    Local $iMax, $iFullSize
    If $aGF_SettingsIndex[$iFrame][0] = 0 Then
        $iMax = Floor(($aSize[0] / 2) - $aGF_SettingsIndex[$iFrame][2])
        $iFullSize = $aSize[0]
    Else
        $iMax = Floor(($aSize[1] / 2) - $aGF_SettingsIndex[$iFrame][2])
        $iFullSize = $aSize[1]
    EndIf
    ; Set minimums
    If $iFirstMin > $iMax Then
        $aGF_SizingIndex[$iFrame][0] = $iMax / $iFullSize
    Else
        $aGF_SizingIndex[$iFrame][0] = $iFirstMin / $iFullSize
    EndIf
    If $iSecondMin > $iMax Then
        $aGF_SizingIndex[$iFrame][1] = $iMax / $iFullSize
    Else
        $aGF_SizingIndex[$iFrame][1] = $iSecondMin / $iFullSize
    EndIf

EndFunc   ;==>_GUIFrame_SetMin

; #FUNCTION# =========================================================================================================
; Name...........:  _GUIFrame_ResizeSet
; Description ...: Sets resizing flag for frames
; Syntax.........:  _GUIFrame_ResizeSet($iFrame = 0)
; Parameters ....: $iFrame - Index of frame set as returned by _GUIFrame_Create
;                  (Default - 0 = all existing frames)
; Requirement(s).: v3.3 +
; Return values .: Success: 2 - All existing frame flags set
;                           1 - Specified flag set
;                  Failure: 0 with @error set to 1 - Invalid frame specified
; Author ........: Melba23
; Modified ......:
; Remarks .......:
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_ResizeSet($iFrame = 0)

    Switch $iFrame
        Case 0 ; Set all frames
            For $i = 1 To $aGF_HandleIndex[0][0]
                $aGF_SettingsIndex[$i][1] = 1
            Next
            Return 2
        Case 1 To $aGF_HandleIndex[0][0] ; Only valid frames accepted
            $aGF_SettingsIndex[$iFrame][1] = 1
            Return 1
        Case Else ; Error
            Return SetError(1, 0, 0)
    EndSwitch

EndFunc   ;==>_GUIFrame_ResizeSet

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_ResizeReg
; Description ...: Registers WM_SIZE message for resizing
; Syntax.........:  _GUIFrame_ResizeReg()
; Parameters ....: None
; Requirement(s).: v3.3 +
; Return values .: Success: 1 - Message handler registered
;                  Failure: 0 with @error set to 1
; Author ........: Melba23
; Modified ......:
; Remarks .......:
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_ResizeReg()

    ; Register the WM_SIZE message
    If $aGF_HandleIndex[0][1] = 0 Then
        Local $iRet = GUIRegisterMsg(0x05, "_GUIFrame_SIZE_Handler") ; $WM_SIZE
        If $iRet Then
            $aGF_HandleIndex[0][1] = 1
            Return 1
        EndIf
    EndIf
    Return SetError(1, 0, 0)

EndFunc   ;==>_GUIFrame_ResizeReg

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_SIZE_Handler
; Description ...: Used to resize frames when a top-level GUI is resized
; Syntax.........: _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
; Parameters ....: None
; Requirement(s).: v3.3 +
; Return values .: None
; Author ........: Melba23
; Modified ......:
; Remarks .......: If the script already has a WM_SIZE handler, then just call this function from within it
;                  and do NOT use the _GUIFrame_ResizeReg function
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)

    #forceref $iMsg, $wParam, $lParam

    Local $iIndex

    ; Get index of base frame set
    For $iIndex = 1 To $aGF_HandleIndex[0][0]
        If $aGF_HandleIndex[$iIndex][4] = $hWnd Then ExitLoop
    Next

    ; If handle not found
    If $iIndex > $aGF_HandleIndex[0][0] Then Return "GUI_RUNDEFMSG"

    ; Get new GUI size
    Local $aSize = WinGetClientSize($hWnd)

    ; Resize frame
    _GUIFrame_Move($iIndex, $aSize[0] * $aGF_SizingIndex[$iIndex][2], $aSize[1] * $aGF_SizingIndex[$iIndex][3], $aSize[0] * $aGF_SizingIndex[$iIndex][4], $aSize[1] * $aGF_SizingIndex[$iIndex][5])

    ; Adjust any resizeable internal framess
    _GUIFrame_AdjIntFrames($iIndex)

    Return "GUI_RUNDEFMSG"

EndFunc   ;==>_GUIFrame_SIZE_Handler

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_GetHandle
; Description ...: Returns the handle of a frame element (required for further splitting)
; Syntax.........: _GUIFrame_GetHandle($iFrame, $iElement)
; Parameters ....: $iFrame - Index of frame set as returned by _GUIFrame_Create
;                  $iElement - 1 = first (left/top) frame, 2 = second (right/bottom) frame
; Requirement(s).: v3.3 +
; Return values .: Success: Handle of frame
;                  Failure: 0 with @error set as follows
;                           1 - Invalid frame specified
;                           2 - Invalid element specified
; Author ........: Kip
; Modified ......: Melba23
; Remarks .......: _GUIFrame_Create requires a GUI handle as a parameter
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_GetHandle($iFrame, $iElement)

    ; Check valid frame index and element
    Switch $iFrame
        Case 1 To $aGF_HandleIndex[0][0]
            Switch $iElement
                Case 1, 2
                    ; Return handle
                    Return $aGF_HandleIndex[$iFrame][$iElement]
            EndSwitch
            Return SetError(2, 0, 0)
    EndSwitch
    Return SetError(1, 0, 0)

EndFunc   ;==>_GUIFrame_GetHandle

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_Switch
; Description ...: Sets a frame element as current GUI
; Syntax.........: _GUIFrame_Switch($iFrame, $iElement)
; Parameters ....: $iFrame - Index of frame set as returned by _GUIFrame_Create
;                  $iElement - 1 = first (left/top) frame, 2 = second (right/bottom) frame
; Requirement(s).: v3.3 +
; Return values .: None
; Author ........: Kip
; Modified ......: Melba23
; Remarks .......: Subsequent controls are created in the specified frame element
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_Switch($iFrame, $iElement)

    ; Check valid frame index and element
    Switch $iFrame
        Case 1 To $aGF_HandleIndex[0][0]
            Switch $iElement
                Case 1, 2
                    ; Switch to specified element
                    Return GUISwitch($aGF_HandleIndex[$iFrame][$iElement])
            EndSwitch
            Return SetError(2, 0, 0)
    EndSwitch
    Return SetError(1, 0, 0)

EndFunc   ;==>_GUIFrame_Switch

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_GetSepPos()
; Description ...: Returns the current position of the separator
; Syntax.........:_GUIFrame_GetSepPos($iFrame)
; Parameters ....: $iFrame - Index of frame set as returned by _GUIFrame_Create
; Requirement(s).: v3.3 +
; Return values .: Success: Position of separator
;                  Failure: -1
; Author ........: Melba23
; Remarks .......: This value can be stored and used as the initial separator position parameter in _GUIFrame_Create
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_GetSepPos($iFrame)

    Local $iSepPos

    ; Check for valid frame index
    If $iFrame < 1 Or $iFrame > $aGF_HandleIndex[0][0] Then Return -1

    ; Get position of first frame
    Local $aFrame_Pos = WinGetPos($aGF_HandleIndex[$iFrame][1])
    ; Get position of separator
    Local $aSep_Pos = WinGetPos($aGF_HandleIndex[$iFrame][3])
    ; Check on separator orientation
    If $aGF_SettingsIndex[$iFrame][0] Then
        $iSepPos = $aSep_Pos[1] - $aFrame_Pos[1]
    Else
        $iSepPos = $aSep_Pos[0] - $aFrame_Pos[0]
    EndIf
    Return $iSepPos

EndFunc

; #FUNCTION# =========================================================================================================
; Name...........: _GUIFrame_Exit()
; Description ...: Deletes all subclassed separator bars to free UDF WndProc and frees registered callback handle
; Syntax.........:_GUIFrame_Exit()
; Parameters ....: None
; Requirement(s).: v3.3 +
; Return values .: None
; Author ........: Kip
; Modified ......: Melba23
; Remarks .......: The user must call _GUIFrame_Exit on exit to delete all subclassed separator bars and so free the
;                  UDF created WndProc.
; Example........: Yes
;=====================================================================================================================
Func _GUIFrame_Exit()

    ; Delete all subclassed separator bars
    For $i = $aGF_HandleIndex[0][0] To 1 Step -1
        GUIDelete($aGF_HandleIndex[$i][3])
    Next
    ; Free registered Callback handle
    DllCallbackFree($hGF_RegCallBack)

EndFunc   ;==>_GUIFrame_Exit

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _GUIFrame_SepSubClass
; Description ...: Sets new WndProc for frame separator bar
; Author ........: Kip
; Modified.......: Melba23
; Remarks .......: This function is used internally by _GUIFrame_Create
; ===============================================================================================================================
Func _GUIFrame_SepSubClass($hWnd)

    ; Check separator has not already been used
    For $i = 1 To $aGF_SepProcIndex[0][0]
        If $aGF_SepProcIndex[$i][0] = $hWnd Then Return 0
    Next

    ; Store current WinProc handle in new array line
    Local $iIndex = $aGF_SepProcIndex[0][0] + 1
    ReDim $aGF_SepProcIndex[$iIndex + 1][2]
    $aGF_SepProcIndex[0][0] = $iIndex
    $aGF_SepProcIndex[$iIndex][0] = $hWnd
    $aGF_SepProcIndex[$iIndex][1] = _WinAPI_SetWindowLong($hWnd, -4, $aGF_SepProcIndex[0][1]) ; $GWL_WNDPROC

    ; Check for subclassing error
    If @error Or $aGF_SepProcIndex[$iIndex][1] = 0 Then Return 0
    ; Return success
    Return 1

EndFunc   ;==>_GUIFrame_SepSubClass

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _GUIFrame_SepWndProc
; Description ...: New WndProc for frame separator bar
; Author ........: Kip
; Modified.......: Melba23
; Remarks .......: This function is used internally by _GUIFrame_SepSubClass
; ===============================================================================================================================
Func _GUIFrame_SepWndProc($hWnd, $iMsg, $wParam, $lParam)

    Local $iSubtract

    If $iMsg = 0x0111 Then ; WM_COMMAND

        ; Check if hWnd is a Separator bar
        For $iIndex = 1 To $aGF_HandleIndex[0][0]
            If $aGF_HandleIndex[$iIndex][3] = $hWnd Then ExitLoop
        Next
        ; If not then pass message on to org WndProc
        If $iIndex > $aGF_HandleIndex[0][0] Then Return _GUIFrame_SepPassMsg($hWnd, $iMsg, $wParam, $lParam)

        ; Extract values from array
        Local $hParent = $aGF_HandleIndex[$iIndex][0]
        Local $hFirstFrame = $aGF_HandleIndex[$iIndex][1]
        Local $hSecondFrame = $aGF_HandleIndex[$iIndex][2]
        Local $hSeparator = $aGF_HandleIndex[$iIndex][3]
        Local $iFirstMin = $aGF_SizingIndex[$iIndex][0]
        Local $iSecondMin = $aGF_SizingIndex[$iIndex][1]
        Local $iSeparatorSize = $aGF_SettingsIndex[$iIndex][2]

        ; Get client size of the parent
        Local $aClientSize = WinGetClientSize($hParent)
        Local $iWidth = $aClientSize[0]
        Local $iHeight = $aClientSize[1]

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

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

            ; Get Separator X-coord
            $iSubtract = $aCInfo[0]

            Do

                ; Get parent X-coord
                $aCInfo = GUIGetCursorInfo($hParent)
                Local $iCursorX = $aCInfo[0]

                ; Determine width of first frame
                Local $iFirstWidth = $iCursorX - $iSubtract
                ; And ensure it is at least minimum
                If $iFirstWidth < $iWidth * $iFirstMin Then $iFirstWidth = $iWidth * $iFirstMin
                If $iWidth - ($iFirstWidth + $iSeparatorSize) < $iWidth * $iSecondMin Then $iFirstWidth = $iWidth - ($iWidth * $iSecondMin) - $iSeparatorSize

                ; Move the GUIs to the correct places
                WinMove($hFirstFrame, "", 0, 0, $iFirstWidth, $iHeight)
                WinMove($hSecondFrame, "", $iFirstWidth + $iSeparatorSize, 0, $iWidth - ($iFirstWidth + $iSeparatorSize), $iHeight)
                WinMove($hSeparator, "", $iFirstWidth, 0, $iSeparatorSize, $iHeight)

                ; Adjust any resizeable internal frames
                _GUIFrame_AdjIntFrames($iIndex)

                ; Do until the mouse button is released
            Until Not _WinAPI_GetAsyncKeyState(0x01)

        ElseIf $aGF_SettingsIndex[$iIndex][0] = 1 Then

            $iSubtract = $aCInfo[1]
            Do
                $aCInfo = GUIGetCursorInfo($hParent)
                Local $iCursorY = $aCInfo[1]
                Local $iFirstHeight = $iCursorY - $iSubtract
                If $iFirstHeight < $iHeight * $iFirstMin Then $iFirstHeight = $iHeight * $iFirstMin
                If $iHeight - ($iFirstHeight + $iSeparatorSize) < $iHeight * $iSecondMin Then $iFirstHeight = $iHeight - ($iHeight * $iSecondMin) - $iSeparatorSize
                WinMove($hFirstFrame, "", 0, 0, $iWidth, $iFirstHeight)
                WinMove($hSecondFrame, "", 0, $iFirstHeight + $iSeparatorSize, $iWidth, $iHeight - ($iFirstHeight + $iSeparatorSize))
                WinMove($hSeparator, "", 0, $iFirstHeight, $iWidth, $iSeparatorSize)
                _GUIFrame_AdjIntFrames($iIndex)
            Until Not _WinAPI_GetAsyncKeyState(0x01)

        EndIf

    EndIf

    ; Pass the message on to org WndProc
    Return _GUIFrame_SepPassMsg($hWnd, $iMsg, $wParam, $lParam)

EndFunc   ;==>_GUIFrame_SepWndProc

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _GUIFrame_SepPassMsg
; Description ...: Passes Msg to frame parent WndProc for action
; Author ........: Kip
; Modified.......: Melba23
; Remarks .......: This function is used internally by _GUIFrame_SepWndProc
; ===============================================================================================================================
Func _GUIFrame_SepPassMsg($hWnd, $iMsg, $wParam, $lParam)

    For $i = 1 To $aGF_SepProcIndex[0][0]
        If $aGF_SepProcIndex[$i][0] = $hWnd Then Return _WinAPI_CallWindowProc($aGF_SepProcIndex[$i][1], $hWnd, $iMsg, $wParam, $lParam)
    Next

EndFunc   ;==>_GUIFrame_SepPassMsg

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _GUIFrame_Move
; Description ...: Moves and resizes frame elements and separator bars
; Author ........: Kip
; Modified.......: Melba23
; Remarks .......: This function is used internally by _GUIFrame_SepWndProc and _GUIFrame_SIZE_Handler
; ===============================================================================================================================
Func _GUIFrame_Move($iFrame, $iX, $iY, $iWidth = 0, $iHeight = 0)

    ; Check valid frame index
    If $iFrame < 1 Or $iFrame > $aGF_HandleIndex[0][0] Then Return 0

    Local $iSeparatorSize = $aGF_SettingsIndex[$iFrame][2]
    Local $iTotal

    ; Set size if not specified
    If Not $iWidth Then $iWidth = _WinAPI_GetWindowWidth($aGF_HandleIndex[$iFrame][0])
    If Not $iHeight Then $iHeight = _WinAPI_GetWindowHeight($aGF_HandleIndex[$iFrame][0])

    ; Move parent
    WinMove($aGF_HandleIndex[$iFrame][0], "", $iX, $iY, $iWidth, $iHeight)

    ; Get size of first frame depending on orientation
    Local $aWinPos = WinGetClientSize($aGF_HandleIndex[$iFrame][1])
    Local $iSize = $aWinPos[0]
    If $aGF_SettingsIndex[$iFrame][0] = 1 Then $iSize = $aWinPos[1]

    ; Set frame min percentages
    Local $iFirstMin = $aGF_SizingIndex[$iFrame][0]
    Local $iSecondMin = $aGF_SizingIndex[$iFrame][1]

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

        ; Move frames and separator as required
        $iTotal = $iWidth
        If $iSize < $iWidth * $iFirstMin Then $iSize = $iWidth * $iFirstMin
        If $iTotal - $iSize - $iSeparatorSize < $iWidth * $iSecondMin Then $iSize = $iTotal - ($iWidth * $iSecondMin) - $iSeparatorSize
        WinMove($aGF_HandleIndex[$iFrame][1], "", 0, 0, $iSize, $iHeight)
        WinMove($aGF_HandleIndex[$iFrame][2], "", $iSize + $iSeparatorSize, 0, $iTotal - $iSize - $iSeparatorSize, $iHeight)
        WinMove($aGF_HandleIndex[$iFrame][3], "", $iSize, 0, $iSeparatorSize, $iHeight)

    ElseIf $aGF_SettingsIndex[$iFrame][0] = 1 Then

        $iTotal = $iHeight
        If $iSize < $iHeight * $iFirstMin Then $iSize = $iHeight * $iFirstMin
        If $iTotal - $iSize - $iSeparatorSize < $iHeight * $iSecondMin Then $iSize = $iTotal - ($iHeight * $iSecondMin) - $iSeparatorSize
        WinMove($aGF_HandleIndex[$iFrame][1], "", 0, 0, $iWidth, $iSize)
        WinMove($aGF_HandleIndex[$iFrame][2], "", 0, $iSize + $iSeparatorSize, $iWidth, $iTotal - $iSize - $iSeparatorSize)
        WinMove($aGF_HandleIndex[$iFrame][3], "", 0, $iSize, $iWidth, $iSeparatorSize)

    EndIf

EndFunc   ;==>_GUIFrame_Move

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _GUIFrame_AdjIntFrames
; Description ...: Moves and resizes internal frame elements when parent frame is resized
; Author ........: Melba23
; Modified.......:
; Remarks .......: This function is called by _GUIFrame_SepWndProc and _GUIFrame_SIZE_Handler
; ===============================================================================================================================
Func _GUIFrame_AdjIntFrames($iIndex)

    Local $aInternal, $iIntIndex, $aPos

    ; Array elements are adjacent for ease of coding
    For $i = 0 To 1

        ; Adjust internal frames of first/second frame if any exist
        If $aGF_HandleIndex[$iIndex][5 + $i] <> 0 Then
            ; StringSplit the element content on "|"
            $aInternal = StringSplit($aGF_HandleIndex[$iIndex][5 + $i], "|")
            ; Then loop though the Number(values) found
            For $j = 1 To $aInternal[0]
                $iIntIndex = Number($aInternal[$j])
                ; Check if internal frame is resizable
                If $aGF_SettingsIndex[$iIntIndex][1] = 1 Then
                    ; Get size of first/second frame
                    $aPos = WinGetPos($aGF_HandleIndex[$iIndex][1 + $i])
                    ; Adjust sizes of the separator and frames
                    _GUIFrame_Move($iIntIndex, $aPos[2] * $aGF_SizingIndex[$iIntIndex][2], $aPos[3] * $aGF_SizingIndex[$iIntIndex][3], $aPos[2] * $aGF_SizingIndex[$iIntIndex][4], $aPos[3] * $aGF_SizingIndex[$iIntIndex][5])
                EndIf
            Next
        EndIf
    Next

EndFunc   ;==>_GUIFrame_AdjIntFrames

New example (last few lines show the new function):

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

#include "GUIFrame.au3"

Global $hButton_3 = 9999, $hButton_4 = 9999

; Create the main GUI
$hGUI_1 = GUICreate("GUI Frames", 600, 500, 100, 100, $WS_SIZEBOX)
GUISetState(@SW_SHOW, $hGUI_1)

; Create a full size vertically-divided frame within the main GUI
$iFrame_A = _GUIFrame_Create($hGUI_1)
; Set min sizes for the frames
_GUIFrame_SetMin($iFrame_A, 100, 100)
; Switch to first (left) frame of Frame_A
_GUIFrame_Switch($iFrame_A, 1)
GUISetBkColor(0xC0C0C0)
$hLabel_1 = GUICtrlCreateLabel("First frame within frame_A", 10, 10, 120, 100)
$hButton_1 = GUICtrlCreateButton("Frame", 10, 200, 80, 30)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE)
; Switch to second (right) frame of Frame_A
_GUIFrame_Switch($iFrame_A, 2)
GUISetBkColor(0xFFC4FF)
$hlabel_2 = GUICtrlCreateLabel("Second frame within frame_A", 10, 10, 120, 100)
$hButton_2 = GUICtrlCreateButton("Frame", 10, 200, 80, 30)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE)

$hGUI_2 = GUICreate("GUI Frames", 400, 400, 900, 100, $WS_SIZEBOX)
GUISetBkColor(0x00D0FF)
GUISetState(@SW_SHOW, $hGUI_2)

; Create a sized horizontally-divided frame within the main GUI
$iFrame_B = _GUIFrame_Create($hGUI_2, 1, 50, 9, 10, 10, 200, 200)
; Set min sizes for the frames
_GUIFrame_SetMin($iFrame_B, 50, 50)
; Switch to first (top) frame of Frame_B
_GUIFrame_Switch($iFrame_B, 1)
GUISetBkColor(0xFF8000)
GUICtrlCreateLabel("First frame within frame_B", 10, 10, 120, 100)
; Switch to second (bottom) frame of Frame_B
_GUIFrame_Switch($iFrame_B, 2)
GUISetBkColor(0x80FF00)
GUICtrlCreateLabel("Second frame within frame_B", 10, 10, 120, 100)

; Register the WM_MOVE message as we do not register it elsewhere in the script
_GUIFrame_ResizeReg()
; Set all existing frames to resizeable
_GUIFrame_ResizeSet(0)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ; Delete all subclassed separators and free Callback
            _GUIFrame_Exit()
            Exit

        Case $hButton_1
            GUICtrlDelete($hLabel_1)
            GUICtrlDelete($hButton_1)

            ; Create a sized horizontally-divided frame control within the left (first) frame of Frame_A
            $iFrame_C = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 1), 0, 0, 3, 10, 10, 200, 200)
            ; Set min sizes for the frames
            _GUIFrame_SetMin($iFrame_C, 50, 50)
            ; Switch to first (top) frame of Frame_B
            _GUIFrame_Switch($iFrame_C, 1)
            GUISetBkColor(0xC4C4FF)
            GUICtrlCreateLabel("First frame within frame_C", 10, 10, 100, 100)
            ; Switch to second (bottom) frame of Frame_C
            _GUIFrame_Switch($iFrame_C, 2)
            GUISetBkColor(0xC4FFC4)
            GUICtrlCreateLabel("Second frame within frame_C", 10, 10, 100, 100)

            ; Create another sized horizontally-divided frame control within the left (first) frame of Frame_A
            $iFrame_D = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 1), 0, 200, 9, 10, 250, 270, 100)
            ; Set min sizes for the frames
            _GUIFrame_SetMin($iFrame_D, 50, 50)
            ; Switch to first (top) frame of Frame_D
            _GUIFrame_Switch($iFrame_D, 1)
            GUISetBkColor(0xC4C480)
            GUICtrlCreateLabel("First frame within frame_D", 10, 10, 100, 100)
            GUICtrlSetState(-1, $GUI_DISABLE)
            $hButton_3 = GUICtrlCreateButton("Pos", 10, 70, 30, 20)
            ; Switch to second (bottom) frame of Frame_D
            _GUIFrame_Switch($iFrame_D, 2)
            GUISetBkColor(0xC480C4)
            GUICtrlCreateLabel("Second frame within frame_D", 10, 10, 50, 100)

            ; Set this lower frame to resizeable
            _GUIFrame_ResizeSet($iFrame_D)

        Case $hButton_2
            GUICtrlDelete($hLabel_2)
            GUICtrlDelete($hButton_2)

            ; Create a full size horizontally-divided frame control within the right (second) frame of Frame_A
            $iFrame_E = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 1)
            ; Set min sizes for the frames
            _GUIFrame_SetMin($iFrame_E, 100, 100)
            ; Switch to first (top) frame of Frame_E - all commands now affect that frame
            _GUIFrame_Switch($iFrame_E, 1)
            GUISetBkColor(0xFFFFC4)
            GUICtrlCreateLabel("First frame within frame_E", 10, 10, 150, 100)
            GUICtrlSetState(-1, $GUI_DISABLE)
            $hButton_4 = GUICtrlCreateButton("Pos", 10, 70, 30, 20)
            ; Switch to second (bottom) frame of Frame_E
            _GUIFrame_Switch($iFrame_E, 2)
            GUISetBkColor(0xFFC4C4)
            GUICtrlCreateLabel("Second frame within frame_E", 10, 10, 150, 100)

            ; Set this frame to resizeable
            _GUIFrame_ResizeSet($iFrame_E)

            ; Try to create a 3rd level frame within Frame_E
            $iFrame_F = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_E, 1))
            If @error = 1 Then MsgBox(0, "Error = 1", "3rd level frame within Frame_E denied")

        Case $hButton_3
            ConsoleWrite("Current SepPos D: " & _GUIFrame_GetSepPos($iFrame_D) & @CRLF) ; <<<<<<<<<<<<<<<<< New function <<<<<<<<<<<<<<<<<<

        Case $hButton_4
            ConsoleWrite("Current SepPos E: " & _GUIFrame_GetSepPos($iFrame_E) & @CRLF) ; <<<<<<<<<<<<<<<<< New function <<<<<<<<<<<<<<<<<<

    EndSwitch

WEnd

Play around with it and see if it does what you want. :graduated:

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

 

  • Moderators
Posted (edited)

Hi all,

See even newer version below! :graduated:

M23

Edited by Melba23

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

 

  • Moderators
Posted (edited)

Hi all,

An even newer beta version of the UDF with the following changes:

- Removal of the limit on child frames. You can now have as many as you can fit in! [New] :graduated:

- Automatic exit clean up by using OnAutoItExitRegister to call the required function. [New]

- Ability to get current separator position within the frame to permit GUI to be recreated as it was left (see post above).[New]

- Ability to set the separator position programatically. [Newest]

Now released - see first post.

M23

Edit: Released.

Edited by Melba23

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)

It's great melba.

There are only 2 problems:

- I don't can test so fast as you can write (also if it is also could here, -5 Grad celsius, snowing).

- I don't have the time to rewrite my frame-scripts.

But next time I will use it.

It's surely interesting to see how it works in a "real world" script.

Thanks for all the work you have done on it and - as I can see on a quick view - I coudn't do.

Reinhard

Edited by ReFran
  • 2 weeks later...
Posted

Melba23 this is awesome! No limit on child frames is so sweet! Oh and thanks for getting back to me on my last question. I cant belive I missed that new function. Posted Image

Keep up the great work and thanks for sharing! Posted Image

  • Moderators
Posted

Beege,

Glad you like it. :x

All,

New version released - see first post for new UDF, examples and zip.

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

 

  • Moderators
Posted

All,

New x64 compatible version released - thanks Yashied. :x

See first post for new UDF and zip. :P

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

 

  • 1 month later...
Posted

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <GuiStatusBar.au3>

#include "GUIFrame.au3"

$oIE = ObjCreate("Shell.Explorer.2")

$hGUI_1 = GUICreate("GUI Frames", 600, 500, 100, 100, $WS_SIZEBOX)

;create frames

$iFrame_A = _GUIFrame_Create($hGUI_1, 1);split gui horizontally

$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2));split top frame vertically

;$iFrame_C = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 1);split bottom frame horizontally again

;set mins

_GUIFrame_SetMin($iFrame_A, 75, 75)

_GUIFrame_SetMin($iFrame_B, 75, 75)

;_GUIFrame_SetMin($iFrame_C, 75, 75)

;get handles to each frame

$hTopLeft = _GUIFrame_GetHandle($iFrame_B, 1)

$hTopright = _GUIFrame_GetHandle($iFrame_B, 2)

$hBottomFrame = _GUIFrame_GetHandle($iFrame_A, 1)

;$hMiddleFrame = _GUIFrame_GetHandle($iFrame_C, 1)

;$hBottomFrame = _GUIFrame_GetHandle($iFrame_C, 2)

_GUIFrame_Switch($iFrame_B,2)

$GUIActiveX = GUICtrlCreateObj( $oIE, 0, 0, 447, 466)

;create status bars

Global $Status1, $Status2, $Status3, $Status4

Global $aStatuswidths[3] = [75,150,225]

Global $aStatusText[3] = ['One', 'Two', 'Three']

;$Status1 = _GUICtrlStatusBar_Create($hTopLeft, $aStatuswidths, $aStatusText)

;$Status2 = _GUICtrlStatusBar_Create($hTopright, $aStatuswidths, $aStatusText)

;$Status3 = _GUICtrlStatusBar_Create($hMiddleFrame, $aStatuswidths, $aStatusText)

$Status4 = _GUICtrlStatusBar_Create($hGUI_1, $aStatuswidths, $aStatusText)

;~ $Status4 = _GUICtrlStatusBar_Create($hBottomFrame, $aStatuswidths, $aStatusText)

;Set backgound colors

GUISetBkColor(0xC0C0C0, $hTopLeft)

GUISetBkColor(0xFFC4FF, $hTopright)

;GUISetBkColor(0x00D0FF, $hMiddleFrame)

GUISetBkColor(0x80FF00, $hBottomFrame)

GUISetState(@SW_SHOW, $hGUI_1)

GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

_GUIFrame_ResizeSet(0)

$oIE.navigate("file://c:\")

While 1

Switch GUIGetMsg()

Case $GUI_EVENT_CLOSE

_GUIFrame_Exit()

; _GUICtrlStatusBar_Destroy($Status1)

; _GUICtrlStatusBar_Destroy($Status2)

; _GUICtrlStatusBar_Destroy($Status3)

_GUICtrlStatusBar_Destroy($Status4)

Exit

EndSwitch

WEnd

Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)

_GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)

_GUICtrlStatusBar_Resize ($Status4)

; _GUICtrlStatusBar_Resize ($Status1)

; _GUICtrlStatusBar_Resize ($Status2)

; _GUICtrlStatusBar_Resize ($Status3)

Return $GUI_RUNDEFMSG

EndFunc

Why open the folder after not repone????????????

  • Moderators
Posted (edited)

neity,

Why open the folder after not repone????????????

I am afraid I have absolutely no idea what you mean by that. :idiot:

If you are asking why the status bar disappears when you resize the frames and only reappears when you resize the GUI, I gave the answer to Beege here - you need to create the status bar before the frames so that the frames base their size on the correct client size. Here is your code with that small change:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include "GUIFrame.au3"

$oIE = ObjCreate("Shell.Explorer.2")
$hGUI_1 = GUICreate("GUI Frames", 600, 500, 100, 100, $WS_SIZEBOX)

;create status bars
Global $Status1, $Status2, $Status3, $Status4
Global $aStatuswidths[3] = [75, 150, 225]
Global $aStatusText[3] = ['One', 'Two', 'Three']
;$Status1 = _GUICtrlStatusBar_Create($hTopLeft, $aStatuswidths, $aStatusText)
;$Status2 = _GUICtrlStatusBar_Create($hTopright, $aStatuswidths, $aStatusText)
;$Status3 = _GUICtrlStatusBar_Create($hMiddleFrame, $aStatuswidths, $aStatusText)
$Status4 = _GUICtrlStatusBar_Create($hGUI_1, $aStatuswidths, $aStatusText)
;~ $Status4 = _GUICtrlStatusBar_Create($hBottomFrame, $aStatuswidths, $aStatusText)

;create frames
$iFrame_A = _GUIFrame_Create($hGUI_1, 1);split gui horizontally
$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2));split top frame vertically
;$iFrame_C = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2), 1);split bottom frame horizontally again

;set mins
_GUIFrame_SetMin($iFrame_A, 75, 75)
_GUIFrame_SetMin($iFrame_B, 75, 75)
;_GUIFrame_SetMin($iFrame_C, 75, 75)

;get handles to each frame
$hTopLeft = _GUIFrame_GetHandle($iFrame_B, 1)
$hTopright = _GUIFrame_GetHandle($iFrame_B, 2)
$hBottomFrame = _GUIFrame_GetHandle($iFrame_A, 1)
;$hMiddleFrame = _GUIFrame_GetHandle($iFrame_C, 1)
;$hBottomFrame = _GUIFrame_GetHandle($iFrame_C, 2)
_GUIFrame_Switch($iFrame_B, 2)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 447, 466)

;Set backgound colors
GUISetBkColor(0xC0C0C0, $hTopLeft)
GUISetBkColor(0xFFC4FF, $hTopright)
;GUISetBkColor(0x00D0FF, $hMiddleFrame)
GUISetBkColor(0x80FF00, $hBottomFrame)

GUISetState(@SW_SHOW, $hGUI_1)
GUIRegisterMsg($WM_SIZE, "_WM_SIZE")

_GUIFrame_ResizeSet(0)

$oIE.navigate("file://c:\")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUIFrame_Exit()
            ; _GUICtrlStatusBar_Destroy($Status1)
            ; _GUICtrlStatusBar_Destroy($Status2)
            ; _GUICtrlStatusBar_Destroy($Status3)
            _GUICtrlStatusBar_Destroy($Status4)
            Exit
    EndSwitch
WEnd

Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam)

    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    _GUICtrlStatusBar_Resize($Status4)
    ; _GUICtrlStatusBar_Resize ($Status1)
    ; _GUICtrlStatusBar_Resize ($Status2)
    ; _GUICtrlStatusBar_Resize ($Status3)

    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_SIZE

You can also see how much easier it is to read if you use code tags - just put [autoit] before and [/autoit] after the posted code. :idiot:

If that was not your question than please ask again. ;)

M23

Edit:

Did you perhaps mean: "Why does the folder not resize when the frames are resized"?

If so, the just set the object to resize too: :D

$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 447, 466)
GUICtrlSetResizing($GUIActiveX, $GUI_DOCKAUTO)

Was that it? :)

Edited by Melba23

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

 

  • Moderators
Posted

neity,

OK, I understand now - it is unresponsive in Vista as well. ;)

I have been experimenting and it seems the problem arises when you put your Shell.Explorer.2 object inside a child GUI when the $parent parameter is used. Swap between the 2 child GUICreate lines in this short test script and you will see that the script crashes when the parameter is used and you try to action the object:

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

$oIE = ObjCreate("Shell.Explorer.2")
$hGUI_1 = GUICreate("Test", 600, 500, 100, 100, $WS_SIZEBOX)
GUISetBkColor(0xFF0000)

;create status bars
Global $Status1, $Status2, $Status3, $Status4
Global $aStatuswidths[3] = [75, 150, 225]
Global $aStatusText[3] = ['One', 'Two', 'Three']
$Status4 = _GUICtrlStatusBar_Create($hGUI_1, $aStatuswidths, $aStatusText)

GUISetState(@SW_SHOW, $hGUI_1)

;$hGUI_2 = GUICreate("Child", 400, 400, 50, 50, $WS_CHILD, -1, $hGUI_1)
$hGUI_2 = GUICreate("Child", 400, 400, 50, 50, $WS_CHILD)

$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 447, 466)
GUICtrlSetResizing($GUIActiveX, $GUI_DOCKAUTO)

GUISetState(@SW_SHOW, $hGUI_2)

$oIE.navigate("file://c:\")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlStatusBar_Destroy($Status4)
            Exit
    EndSwitch
WEnd

As you can see from the script, as soon as you use the $parent parameter the Shell.Explorer.2 object becomes unresponsive. I have no idea why this happens - I will enquire further. But as you need the $parent parameter to place the child window (you can also see this from the script), no control over the position of the child GUIs = no GUIFrame UDF. :idiot:

However, Beege produced this UDF which gives you control over the folder structure within a frame GUI and which works well - perhaps you might like to take a look at that rather then stick with the Shell.Explorer.2 object. :)

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)

thank,i want explorer's ContextMenu. so not ExpFrame . wish your code very good! thank you very much.

Edited by neity
Posted

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include "GUIFrame.au3"
#include <ButtonConstants.au3>
#include <Misc.au3>
#include <StaticConstants.au3>
#Include <GuiListView.au3>
#include <ListviewConstants.au3>
#include <TreeviewConstants.au3>
#include <String.au3>
#include <ButtonConstants.au3>
#Include <WinAPIEx.au3>
#Include <File.au3>
#include <GUIComboBox.au3>
#include <GUITreeView.au3>
#Include <GuiMenu.au3>
#Include <TVExplorer.au3>
#include <IE.au3>

Opt("GUIonEventMode", 1)
Global $MainWinSize, $Status,$PushHistory = 1,$HistoryDir ="",$hListView,$Style, $hFocus = 0
Global $aStatuswidths[3] = [225,225,-1]
Global $aStatusText[3] = ['', '', '']
Global $msg, $hTreeView, $hImageList, $hItem, $hNext, $X, $Y, $sPath, $sRoot = "c:\windows",$hSelect = 0, $hInput, $Input, $Dummy,$TVN_BEGINDRAG,$gaDropFiles[1],$hv,$h_list
$sTitle = "test"
;$oIE = ObjCreate("Shell.Explorer.2")
$oIE = _IECreateEmbedded()

If Not _WinAPI_DwmIsCompositionEnabled() Then
    $Style = $WS_EX_COMPOSITED
Else
    $Style = -1
EndIf

$hGUI = GUICreate($sTitle, 762, 578, -1, -1, $WS_OVERLAPPEDWINDOW,$Style)
GUISetOnEvent($GUI_EVENT_CLOSE, '_GUIEvent')
GUISetIcon(@WindowsDir & '\explorer.exe')
$MainWinSize = WinGetClientSize($hGUI)
$nFileMenu      = GUICtrlCreateMenu("文件(&F)")
$editMenu       = GUICtrlCreateMenu("编辑(&E)")
$nViewMenu      = GUICtrlCreateMenu("查看(&V)")
$nViewItem1     = GUICtrlCreateMenuItem("大图标", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_lIcon")
$nViewItem2     = GUICtrlCreateMenuItem("详细信息", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_detail")
GUICtrlSetState(-1, $GUI_CHECKED)
$nViewItem3     = GUICtrlCreateMenuItem("小图标", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_sIcon")
$nViewItem4     = GUICtrlCreateMenuItem("列表", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_list")
$nExtraMenu     = GUICtrlCreateMenu("其他(&X)")
$nHelpMenu      = GUICtrlCreateMenu("帮助(&H)")
$nExitItem      = GUICtrlCreateMenuItem("退出",$nFileMenu)
GuiCtrlSetOnEvent(-1, "_exit")
$nAboutItem     = GUICtrlCreateMenuItem("关于",$nHelpMenu)
;create status bars

$Status = _GUICtrlStatusBar_Create($hGUI, $aStatuswidths, $aStatusText)

;GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC")

;GUISetState()
;create frames
$iFrame_A = _GUIFrame_Create($hGUI, 1,74);split gui horizontally
$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2),0,$MainWinSize[0]/3);split top frame vertically

;set mins
_GUIFrame_SetMin($iFrame_A, 75, 75)
_GUIFrame_SetMin($iFrame_B, 75, 75)

;get handles to each frame
$hTopFrame = _GUIFrame_GetHandle($iFrame_A, 1)
$hBottomLeft = _GUIFrame_GetHandle($iFrame_B, 1)
$hBottomright = _GUIFrame_GetHandle($iFrame_B, 2)

_GUIFrame_Switch($iFrame_A,1)
$Group1 = GUICtrlCreateGroup("", 2, 0, 758, 44)
$cmdBack = GUICtrlCreateButton("", 4, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\5.ico", 0, 0)
GuiCtrlSetOnEvent(-1, "Back_Click")
GUICtrlCreateButton("", 35, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\6.ico", 0, 0)
$cmdParentDir = GUICtrlCreateButton("", 66, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\7.ico", 0, 0)
;GuiCtrlSetOnEvent(-1, "cmdParentDir_Click")

$cmdCut = GUICtrlCreateButton("", 108, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\8.ico", 0, 0)

$cmdCopy = GUICtrlCreateButton("", 139, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\9.ico", 0, 0)

$cmdPaste = GUICtrlCreateButton("", 170, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\10.ico", 0, 0)


GUICtrlCreateButton("", 212, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\11.ico", 0, 0)
GUICtrlCreateButton("", 243, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\12.ico", 0, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("", 2, 36, 758, 34)
GUICtrlCreateLabel("地址栏(&D):", 8, 48, 60, 20)
GUICtrlSetFont(-1, 8.5, 400, 0, "Tahoma")
$Input = GUICtrlCreateCombo("", 75, 46, 600, 20)
$hInput = GUICtrlGetHandle(-1)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$cmdAddress = GUICtrlCreateButton("", 680, 46, 22, 20, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\4.ico", 0, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

_GUIFrame_Switch($iFrame_B,1)
$hTV = _GUICtrlTVExplorer_Create($sRoot, 0, 0, 310, 466, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent')
;$nTreeView = GUICtrlCreateTreeView(0, 0, 310, 466, -1, $WS_EX_CLIENTEDGE)
;$hTreeView = GUICtrlGetHandle($nTreeView)
$h_tree = ControlGetHandle($hGui, "", $hTV)
_TVSetPath($Input, _GUICtrlTVExplorer_GetSelected($hTV))
_GUICtrlTVExplorer_SetExplorerStyle($hTV)
$Dummy = GUICtrlCreateDummy()

GUICtrlSetOnEvent(-1, '_GUIEvent')
GUIRegisterMsg($WM_GETMINMAXINFO, 'WM_GETMINMAXINFO')
GUIRegisterMsg($WM_SIZE, 'WM_SIZE')
HotKeySet('{F5}', '_TVRefresh')

_GUIFrame_Switch($iFrame_B,2)
;$GUIActiveX = GUICtrlCreateObj( $oIE, 0, 0, 505, 466)
$GUIActiveX = GUICtrlCreateObj( $oIE, 0, 0 , 505, 466 )
GUICtrlSetResizing(-1, 1)

;Set backgound colors
GUISetBkColor(0xC0C0C0, $hBottomLeft)
GUISetBkColor(0xFFC4FF, $hBottomright)
GUISetBkColor(0x80FF00, $hTopFrame)

;GUISetState(@SW_SHOW, $hGUI_1)
_GUIFrame_ResizeReg()
_GUIFrame_ResizeSet(0)

_LVOpen($sRoot)

GUISetState(@SW_SHOW, $hGUI)

_GUICtrlTVExplorer_Expand($hTV, $sRoot)


While 1
    Sleep(200)
WEnd

Func _GUIEvent()

    Local $Path

    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            _GUICtrlTVExplorer_DestroyAll()
            Exit
        Case $GUI_EVENT_PRIMARYUP
            open()
        Case $Dummy
            $Path = _GUICtrlTVExplorer_GetSelected($hFocus)
            _GUICtrlTVExplorer_AttachFolder($hFocus)
            _GUICtrlTVExplorer_Expand($hFocus, $Path, 0)
            $hFocus = 0
    EndSwitch
EndFunc   ;==>_GUIEvent

Func _TVEvent($hWnd, $iMsg, $sPath, $hItem)
    Switch $iMsg
        Case $TV_NOTIFY_BEGINUPDATE
            GUISetCursor(1, 1)
        Case $TV_NOTIFY_ENDUPDATE
            GUISetCursor(2)
        Case $TV_NOTIFY_SELCHANGED
            If $hTV = $hWnd Then
                _TVSetPath($Input, $sPath)
                ContinueCase
            EndIf
        Case $TV_NOTIFY_DBLCLK
            ; Nothing
        Case $TV_NOTIFY_RCLICK
            ; Nothing
        Case $TV_NOTIFY_DELETINGITEM
            ; Nothing
        Case $TV_NOTIFY_DISKMOUNTED
            ; Nothing
        Case $TV_NOTIFY_DISKUNMOUNTED
            ; Nothing
    EndSwitch
EndFunc   ;==>_TVEvent

Func _TVSetPath($iInput, $sPath)

    Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2)

    If GUICtrlRead($iInput) <> $Text Then
        GUICtrlSetData($iInput, $Text)
    EndIf
EndFunc   ;==>_TVSetPath

Func _TVRefresh()

    Local $hWnd = _WinAPI_GetFocus()

        If $hTV = $hWnd Then
            If Not $hFocus Then
                $hFocus = $hWnd
                GUICtrlSendToDummy($Dummy)
            EndIf
            Return
        EndIf
    HotKeySet('{F5}')
    Send('{F5}')
    HotKeySet('{F5}', '_TVRefresh')
EndFunc   ;==>_TVRefresh

Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    _GUICtrlStatusBar_Resize ($Status)
    Local $tMMI = DllStructCreate('long Reserved[2];long MaxSize[2];long MaxPosition[2];long MinTrackSize[2];long MaxTrackSize[2]', $lParam)

    Switch $hWnd
        Case $hGUI
            DllStructSetData($tMMI, 'MinTrackSize', 428, 1)
            DllStructSetData($tMMI, 'MinTrackSize', 450, 2)
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_GETMINMAXINFO

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    
    Local $WC, $HC, $WT, $HT
    Switch $hWnd
        Case $hGUI
            $WC = _WinAPI_LoWord($lParam)
            $HC = _WinAPI_HiWord($lParam)
            $WT = Floor(($WC - 60) / 2)
            $HT = Floor(($HC - 116) / 2)
            GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV), 20, 48, $WT, $HT)
            GUICtrlSetPos($Input, 75, 46, $WT)
            _TVSetPath($Input, _GUICtrlTVExplorer_GetSelected($hTV))
            Return 0
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func _sIcon()
     ControlListView($hv, "", "SysListView321", "ViewChange", "smallicons")
EndFunc

Func _lIcon()
    ControlListView($hv, "", "SysListView321", "ViewChange", "largeicons")
EndFunc

Func _list()
    ControlListView($hv, "", "SysListView321", "ViewChange", "list")
EndFunc

Func _detail()
    ControlListView($hv, "", "SysListView321", "ViewChange", "details")
EndFunc

Func _status()
    $hItem = ControlTreeView ($hGui, "", $h_tree, "GetSelected")
    $Count = ControlTreeView ($hGui, "", $h_tree, "GetItemCount", $hItem)
;   MsgBox(0,"",$hItem)
    If $Count > 0 Then
        _GUICtrlStatusBar_SetText($Status, $Count & " 对象")
        $path = _TVGetPath($hTreeView, $hItem, $sRoot)
        _GUICtrlStatusBar_SetText($Status, $path, 2)
    Else
        _GUICtrlStatusBar_SetText($Status, "准备好")
    EndIf
EndFunc

Func _RightClickMenu($hTV)

    ;Create popup menu
    Local $hMenu = _GUICtrlMenu_CreatePopup(8)

    ;Enumerate some values for menu item tracking
    Local Enum $iOption_1 = 1, $iOption_2, $iOption_3, $iOption_4, $iOption_5,$iOption_6,$iOption_7,$iOption_8,$iOption_9
    ;Add menus
    _GUICtrlMenu_AddMenuItem($hMenu, "新建", $iOption_1)
    _GUICtrlMenu_AddMenuItem($hMenu, "刷新", $iOption_2)
    _GUICtrlMenu_AddMenuItem($hMenu, "搜索", $iOption_3)
    _GUICtrlMenu_AddMenuItem($hMenu, "展开", $iOption_4)
    _GUICtrlMenu_AddMenuItem($hMenu, "折叠", $iOption_5)
    _GUICtrlMenu_AddMenuItem($hMenu, "重命名", $iOption_6)

    ; Check which item was selected
    Local $mitem = _GUICtrlMenu_TrackPopupMenu($hMenu, $hTV, -1, -1, 1, 1, 2)
    ;Execute menu option
    Switch $mitem
        Case $iOption_1
            _TVnewdir($hTreeView, $hItem, $sRoot)
;           ConsoleWrite('Menu option 1 was selected' & @CRLF)
        Case $iOption_2
            _TVrefresh()
;           ConsoleWrite('Menu Option 2 was selected' & @CRLF)
        Case $iOption_3
            Search()
;           ConsoleWrite('Menu Option 3 was selected' & @CRLF)
        Case $iOption_4
            expand()
;           ConsoleWrite('Menu Option 2 was selected' & @CRLF)
        Case $iOption_5
            Collapse()
        Case $iOption_6
            Rename()
    EndSwitch

    ;free menu resorces
    _GUICtrlMenu_DestroyMenu($hMenu)

EndFunc   ;==>_RightClickMenu

Func Rename()
    $sitem = ControlTreeView($hGUI, "", $h_tree, "GetSelected")
    $str = StringSplit($sitem, "|")
    $sitem = $str[$str[0]]
    $Input1 = InputBox("重命名treeview项", "输入一个新的名称", $sitem, "", 200, 120)
    If $Input1 <> "" Then
        GUICtrlSetData($sitem, "Rename " & $Input1)
        GUICtrlSetData($sitem, $Input1)
    EndIf
    $sitem = "" 
EndFunc

Func Back_Click()
    Local $sPop = _HistoryPoP()
    If $sPop <> -1 Then
      _LVOpen($sPop)
      _LVCombo($sPop)
  EndIf
  ;MsgBox(0,"",$sPop)
EndFunc

Func _LVOpen($sPath)
    $attrib = FileGetAttrib($sPath)              
    If $sPath <> "" And $attrib = "D" Then  
       $ListView = _IENavigate($oIE, $sPath, 0)
       GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKBOTTOM)
       $hv = WinGetHandle($ListView)
       $hListView = GUICtrlGetHandle($ListView)
       $h_list = ControlGetHandle($hGui, "", $ListView)
       If $PushHistory Then _HistoryPush($sPath)
    EndIf
EndFunc

Func _TVGetPath($hTV, $hItem, $sRoot)

    Local $Path = StringRegExpReplace(_GUICtrlTreeView_GetTree($hTV, $hItem), '([|]+)|(\\[|])', '\\')

    If Not $Path Then
        Return ''
    EndIf
    If Not StringInStr($Path, ':') Then
        Return StringRegExpReplace($sRoot, '(\\[^\\]*(\\|)+)\Z', '\\') & $Path
    EndIf
    Return $Path
EndFunc   ;==>_TVGetPath

Func _TVCombo($hTV)
     _GUICtrlComboBox_BeginUpdate($Input)
     _GUICtrlComboBox_InsertString($Input, _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554), 0)
     _GUICtrlComboBox_EndUpdate($Input)
     _GUICtrlComboBox_SetEditText($Input,_WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554))
     _GUICtrlComboBox_AutoComplete($Input)
     $hSelect = $hItem
EndFunc
 
Func _LVCombo($sPath)
     _GUICtrlComboBox_BeginUpdate($Input)
     _GUICtrlComboBox_InsertString($Input, $sPath, 0)
     _GUICtrlComboBox_EndUpdate($Input)
     _GUICtrlComboBox_SetEditText($Input,$sPath)
     _GUICtrlComboBox_AutoComplete($Input)
     $hSelect = $hItem  
EndFunc

Func _TVRunfile($hTV, $hItem, $sRoot)
    $path = _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554)
    $attrib = FileGetAttrib($path)               
    If $path <> "" And $attrib = "D" Then
        _TVCombo($hTV)
    Else
        ShellExecuteWait ($path)
    EndIf   
EndFunc

Func _TvLvOpen($hTV, $hItem, $sRoot)
    $sPath = _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554)
    $attrib = FileGetAttrib($sPath)              
    If $sPath <> "" And $attrib = "D" Then
       _LVOpen($sPath)
    EndIf
EndFunc 

Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam)
    Local $nSize, $pFileName
    Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
    For $i = 0 To $nAmt[0] - 1
        $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
        $nSize = $nSize[0] + 1
        $pFileName = DllStructCreate("char[" & $nSize & "]")
        DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize)
        ReDim $gaDropFiles[$i + 1]
        $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
        $pFileName = 0
    Next
EndFunc   ;==>WM_DROPFILES_FUNC

Func _TVnewdir($hTV, $hItem, $sRoot)
    $path = _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554)
    $attrib = FileGetAttrib($path)                       
    If $path <> "" And $attrib = "D" Then
        $dirname = InputBox("新建文件夹", "输入文件夹名称:", "", "")
        RunWait(@ComSpec & " /c " & "MD " & $path & "\" & $dirname,"",@SW_HIDE)
        
;   MsgBox (0,"展开",$TVtext)
    EndIf
EndFunc

Func Search()
    Local $char
    $txt = InputBox("目录内搜索","请输入文件名:","","")
    $rst = StringInStr($txt,".")
    If $rst = 0 Then
        $txt = $txt & ".doc"
    Else
        $txt = $char
    EndIf
    $hItemFound =  _GUICtrlTreeView_FindItem($hTreeView,$txt)
    If $hItemFound Then
       _GUICtrlTreeView_EnsureVisible($hTreeView,$hItemFound) ;scroll and expand the treeview if needed to get the item visible
       _GUICtrlTreeView_SelectItem($hTreeView,$hItemFound) ;select the item.
;       MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
    Else
        MsgBox(4160, "消息", "文件没发现!")
    EndIf

EndFunc

Func expand()
    $txt = ControlTreeView ($hGui, "", $h_tree, "GetSelected")
    ControlTreeView ($hGui, "", $h_tree, "Expand", $txt)
EndFunc

Func Collapse()
    $txt = ControlTreeView ($hGui, "", $h_tree, "GetSelected")
    ControlTreeView ($hGui, "", $h_tree, "Collapse", $txt)
EndFunc

Func open()
    Local $tPoint, $hWnd
    $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData ( $tPoint, "X", MouseGetPos(0))
    DllStructSetData ( $tPoint, "Y", MouseGetPos(1))
    $hWnd = _WinAPI_WindowFromPoint($tPoint)
;   MsgBox(0,"",_WinAPI_GetClassName($hWnd))
    If _WinAPI_GetClassName($hWnd) = "SysListView32" Then
;           ControlClick ($hv, "", "SysListView321")    
        $sel = ControlListView($hv, "", "SysListView321", "GetSelected")
        If ControlListView($hv, "", "SysListView321", "IsSelected",$sel) = 1 Then 
            $dir = ControlListView($hv, "", "SysListView321", "GetText",$sel)
            $sPath = $sPath & "\" & $dir
            $attrib = FileGetAttrib($sPath)
            If $attrib = "D" Then
                _LVOpen($sPath)
                _LVCombo($sPath)
            EndIf                  
        Endif
    Endif
;   Sleep(200)
EndFunc

Func _ShowFileProperties($sFile, $sVerb = "properties", $hWnd = 0)
    ; function by Rasim
    ; http://www.autoItscript.com/forum/index....p?showtopic=78236&view=findpos

    Local Const $SEE_MASK_INVOKEIDLIST = 0xC
    Local Const $SEE_MASK_NOCLOSEPROCESS = 0x40
    Local Const $SEE_MASK_FLAG_NO_UI = 0x400

    Local $PropBuff, $FileBuff, $SHELLEXECUTEINFO

    $PropBuff = DllStructCreate("char[256]")
    DllStructSetData($PropBuff, 1, $sVerb)

    $FileBuff = DllStructCreate("char[256]")
    DllStructSetData($FileBuff, 1, $sFile)

    $SHELLEXECUTEINFO = DllStructCreate("int cbSize;long fMask;hwnd hWnd;ptr lpVerb;ptr lpFile;ptr lpParameters;ptr lpDirectory;" & _
            "int nShow;int hInstApp;ptr lpIDList;ptr lpClass;hwnd hkeyClass;int dwHotKey;hwnd hIcon;" & _
            "hwnd hProcess")

    DllStructSetData($SHELLEXECUTEINFO, "cbSize", DllStructGetSize($SHELLEXECUTEINFO))
    DllStructSetData($SHELLEXECUTEINFO, "fMask", $SEE_MASK_INVOKEIDLIST)
    DllStructSetData($SHELLEXECUTEINFO, "hwnd", $hWnd)
    DllStructSetData($SHELLEXECUTEINFO, "lpVerb", DllStructGetPtr($PropBuff, 1))
    DllStructSetData($SHELLEXECUTEINFO, "lpFile", DllStructGetPtr($FileBuff, 1))

    $aRet = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($SHELLEXECUTEINFO))
    If $aRet[0] = 0 Then Return SetError(2, 0, 0)

    Return $aRet[0]
EndFunc   ;==>_ShowFileProperties

Func _exit()
    _GUICtrlStatusBar_Destroy($Status)
    _GUIFrame_Exit()
    Exit 
EndFunc

Func _HistoryPush($sDir)
    $HistoryDir = $sDir & '|' & $HistoryDir
EndFunc   ;==>_HistoryPush

Func _HistoryPoP()
    Local $aSplit = StringSplit($HistoryDir, '|', 2)
    If $aSplit[0] = '' Then Return -1
    Local $sReturn = $aSplit[0]
    _ArrayDelete($aSplit, 0)
    $HistoryDir = _ArrayToString($aSplit, '|')
    Return $sReturn
EndFunc   ;==>_HistoryPoP

Func test()
    Local $tPOINT = DllStructCreate("int X;int Y")
                   
    DllStructSetData($tPOINT, "X", MouseGetPos(0))
    DllStructSetData($tPOINT, "Y", MouseGetPos(1))
                   
    _ScreenToClient($hTreeView, $tPOINT)
                   
    Local $iX = DllStructGetData($tPOINT, "X")
    Local $iY = DllStructGetData($tPOINT, "Y")
                   
    Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, $iX, $iY)
    If $iItem <> 0 And _GUICtrlTreeView_Level ($hTreeView, $iItem) = 1 Then 
        $index = _GUICtrlTreeView_GetItemParam($hTreeView, $iItem)
        ShellExecute($sPath & _GUICtrlTreeView_GetText($hTreeView, $iItem))
    EndIf
EndFunc

Func _ScreenToClient($hWnd, $tPOINT)
    Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _
                                                "hwnd", $hTreeView, _
                                                "ptr", DllStructGetPtr($tPOINT))
    Return $aRet[0]
EndFunc;==>_ScreenToClient

  • Moderators
Posted

neity,

If you want help, please at least try to describe the problem rather than just posting a wadge of code. ;)

I take it you are not getting what you want from the code you posted. If you specify the size of the objects based on the size of the frames, you get this, which looks pretty close to the image you posted (look for the <<<<<<< lines):

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include "GUIFrame.au3"
#include <ButtonConstants.au3>
#include <Misc.au3>
#include <StaticConstants.au3>
#Include <GuiListView.au3>
#include <ListviewConstants.au3>
#include <TreeviewConstants.au3>
#include <String.au3>
#include <ButtonConstants.au3>
#Include <WinAPIEx.au3>
#Include <File.au3>
#include <GUIComboBox.au3>
#include <GUITreeView.au3>
#Include <GuiMenu.au3>
#Include <TVExplorer.au3>
#include <IE.au3>

Opt("GUIonEventMode", 1)

Global $MainWinSize, $Status,$PushHistory = 1,$HistoryDir ="",$hListView,$Style, $hFocus = 0
Global $aStatuswidths[3] = [225,225,-1]
Global $aStatusText[3] = ['', '', '']
Global $msg, $hTreeView, $hImageList, $hItem, $hNext, $X, $Y, $sPath, $sRoot = "c:\windows",$hSelect = 0, $hInput, $Input, $Dummy,$TVN_BEGINDRAG,$gaDropFiles[1],$hv,$h_list
$sTitle = "test"
;$oIE = ObjCreate("Shell.Explorer.2")
$oIE = _IECreateEmbedded()

If Not _WinAPI_DwmIsCompositionEnabled() Then
    $Style = $WS_EX_COMPOSITED
Else
    $Style = -1
EndIf

$hGUI = GUICreate($sTitle, 762, 578, -1, -1, $WS_OVERLAPPEDWINDOW,$Style)
GUISetOnEvent($GUI_EVENT_CLOSE, '_GUIEvent')

GUISetIcon(@WindowsDir & '\explorer.exe')

$nFileMenu      = GUICtrlCreateMenu("??(&F)")
$editMenu       = GUICtrlCreateMenu("??(&E)")
$nViewMenu      = GUICtrlCreateMenu("??(&V)")
$nViewItem1     = GUICtrlCreateMenuItem("???", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_lIcon")
$nViewItem2     = GUICtrlCreateMenuItem("????", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_detail")
GUICtrlSetState(-1, $GUI_CHECKED)
$nViewItem3     = GUICtrlCreateMenuItem("???", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_sIcon")
$nViewItem4     = GUICtrlCreateMenuItem("??", $nViewMenu, -1, 1)
GuiCtrlSetOnEvent(-1, "_list")
$nExtraMenu     = GUICtrlCreateMenu("??(&X)")
$nHelpMenu      = GUICtrlCreateMenu("??(&H)")
$nExitItem      = GUICtrlCreateMenuItem("??",$nFileMenu)
GuiCtrlSetOnEvent(-1, "_exit")
$nAboutItem     = GUICtrlCreateMenuItem("??",$nHelpMenu)

;create status bars
$Status = _GUICtrlStatusBar_Create($hGUI, $aStatuswidths, $aStatusText)

;GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC")

$MainWinSize = WinGetClientSize($hGUI)

;GUISetState()
;create frames
$iFrame_A = _GUIFrame_Create($hGUI, 1,74);split gui horizontally

ConsoleWrite($iFrame_A & @CRLF)

$iFrame_B = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_A, 2),0,$MainWinSize[0]/3);split top frame vertically

;set mins
_GUIFrame_SetMin($iFrame_A, 75, 75)
_GUIFrame_SetMin($iFrame_B, 75, 75)

;get handles to each frame
$hTopFrame = _GUIFrame_GetHandle($iFrame_A, 1)
$hBottomLeft = _GUIFrame_GetHandle($iFrame_B, 1)
$hBottomright = _GUIFrame_GetHandle($iFrame_B, 2)

_GUIFrame_Switch($iFrame_A,1)
$Group1 = GUICtrlCreateGroup("", 2, 0, 758, 44)
$cmdBack = GUICtrlCreateButton("", 4, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\5.ico", 0, 0)
;GuiCtrlSetOnEvent(-1, "Back_Click")
GUICtrlCreateButton("", 35, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\6.ico", 0, 0)
$cmdParentDir = GUICtrlCreateButton("", 66, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\7.ico", 0, 0)
;GuiCtrlSetOnEvent(-1, "cmdParentDir_Click")

$cmdCut = GUICtrlCreateButton("", 108, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\8.ico", 0, 0)

$cmdCopy = GUICtrlCreateButton("", 139, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\9.ico", 0, 0)

$cmdPaste = GUICtrlCreateButton("", 170, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\10.ico", 0, 0)


GUICtrlCreateButton("", 212, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\11.ico", 0, 0)
GUICtrlCreateButton("", 243, 9, 32, 32, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\12.ico", 0, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("", 2, 36, 758, 34)
GUICtrlCreateLabel("???(&D):", 8, 48, 60, 20)
GUICtrlSetFont(-1, 8.5, 400, 0, "Tahoma")
$Input = GUICtrlCreateCombo("", 75, 46, 600, 20)
$hInput = GUICtrlGetHandle(-1)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$cmdAddress = GUICtrlCreateButton("", 680, 46, 22, 20, $BS_ICON + $BS_FLAT)
GUICtrlSetImage(-1, "icons\4.ico", 0, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

_GUIFrame_Switch($iFrame_B,1)

$WinSize = WinGetClientSize($hBottomLeft) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$hTV = _GUICtrlTVExplorer_Create($sRoot, 0, 0, $WinSize[0], $WinSize[1], -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

$nTreeView = GUICtrlCreateTreeView(0, 0, 310, 466, -1, $WS_EX_CLIENTEDGE)
$hTreeView = GUICtrlGetHandle($nTreeView)
$h_tree = ControlGetHandle($hGui, "", $hTV)
_TVSetPath($Input, _GUICtrlTVExplorer_GetSelected($hTV))
_GUICtrlTVExplorer_SetExplorerStyle($hTV)
$Dummy = GUICtrlCreateDummy()

GUICtrlSetOnEvent(-1, '_GUIEvent')
GUIRegisterMsg($WM_GETMINMAXINFO, 'WM_GETMINMAXINFO')
GUIRegisterMsg($WM_SIZE, 'WM_SIZE')
HotKeySet('{F5}', '_TVRefresh')

_GUIFrame_Switch($iFrame_B,2)

$WinSize = WinGetClientSize($hBottomright) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$GUIActiveX = GUICtrlCreateObj( $oIE, 0, 0 , $WinSize[0], $WinSize[1]) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetResizing(-1, 1)

;Set backgound colors
GUISetBkColor(0xC0C0C0, $hBottomLeft)
GUISetBkColor(0xFFC4FF, $hBottomright)
GUISetBkColor(0x80FF00, $hTopFrame)

;GUISetState(@SW_SHOW, $hGUI_1)
_GUIFrame_ResizeReg()
_GUIFrame_ResizeSet(0)

_LVOpen($sRoot)

GUISetState(@SW_SHOW, $hGUI)

_GUICtrlTVExplorer_Expand($hTV, $sRoot)


While 1
    Sleep(200)
WEnd

Func _GUIEvent()

    Local $Path

    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            ;_GUICtrlTVExplorer_DestroyAll()
            Exit
        Case $GUI_EVENT_PRIMARYUP
            ;open()
;        Case $Dummy
 ;           $Path = _GUICtrlTVExplorer_GetSelected($hFocus)
  ;          _GUICtrlTVExplorer_AttachFolder($hFocus)
   ;         _GUICtrlTVExplorer_Expand($hFocus, $Path, 0)
    ;        $hFocus = 0
    EndSwitch
EndFunc   ;==>_GUIEvent

Func _TVEvent($hWnd, $iMsg, $sPath, $hItem)
    Switch $iMsg
        Case $TV_NOTIFY_BEGINUPDATE
            GUISetCursor(1, 1)
        Case $TV_NOTIFY_ENDUPDATE
            GUISetCursor(2)
        Case $TV_NOTIFY_SELCHANGED
            If $hTV = $hWnd Then
                _TVSetPath($Input, $sPath)
                ContinueCase
            EndIf
        Case $TV_NOTIFY_DBLCLK
            ; Nothing
        Case $TV_NOTIFY_RCLICK
            ; Nothing
        Case $TV_NOTIFY_DELETINGITEM
            ; Nothing
        Case $TV_NOTIFY_DISKMOUNTED
            ; Nothing
        Case $TV_NOTIFY_DISKUNMOUNTED
            ; Nothing
    EndSwitch
EndFunc   ;==>_TVEvent

Func _TVSetPath($iInput, $sPath)

    Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2)

    If GUICtrlRead($iInput) <> $Text Then
        GUICtrlSetData($iInput, $Text)
    EndIf
EndFunc   ;==>_TVSetPath

Func _TVRefresh()

    Local $hWnd = _WinAPI_GetFocus()

        If $hTV = $hWnd Then
            If Not $hFocus Then
                $hFocus = $hWnd
                GUICtrlSendToDummy($Dummy)
            EndIf
            Return
        EndIf
    HotKeySet('{F5}')
    Send('{F5}')
    HotKeySet('{F5}', '_TVRefresh')
EndFunc   ;==>_TVRefresh

Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
    _GUIFrame_SIZE_Handler($hWnd, $iMsg, $wParam, $lParam)
    _GUICtrlStatusBar_Resize ($Status)
    Local $tMMI = DllStructCreate('long Reserved[2];long MaxSize[2];long MaxPosition[2];long MinTrackSize[2];long MaxTrackSize[2]', $lParam)

    Switch $hWnd
        Case $hGUI
            DllStructSetData($tMMI, 'MinTrackSize', 428, 1)
            DllStructSetData($tMMI, 'MinTrackSize', 450, 2)
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_GETMINMAXINFO

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)

    Local $WC, $HC, $WT, $HT
    Switch $hWnd
        Case $hGUI
            $WC = _WinAPI_LoWord($lParam)
            $HC = _WinAPI_HiWord($lParam)
            $WT = Floor(($WC - 60) / 2)
            $HT = Floor(($HC - 116) / 2)
            GUICtrlSetPos(_WinAPI_GetDlgCtrlID($hTV), 20, 48, $WT, $HT)
            GUICtrlSetPos($Input, 75, 46, $WT)
            _TVSetPath($Input, _GUICtrlTVExplorer_GetSelected($hTV))
            Return 0
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func _sIcon()
     ControlListView($hv, "", "SysListView321", "ViewChange", "smallicons")
EndFunc

Func _lIcon()
    ControlListView($hv, "", "SysListView321", "ViewChange", "largeicons")
EndFunc

Func _list()
    ControlListView($hv, "", "SysListView321", "ViewChange", "list")
EndFunc

Func _detail()
    ControlListView($hv, "", "SysListView321", "ViewChange", "details")
EndFunc

Func _status()
    $hItem = ControlTreeView ($hGui, "", $h_tree, "GetSelected")
    $Count = ControlTreeView ($hGui, "", $h_tree, "GetItemCount", $hItem)
;   MsgBox(0,"",$hItem)
    If $Count > 0 Then
        _GUICtrlStatusBar_SetText($Status, $Count & " ??")
        $path = _TVGetPath($hTreeView, $hItem, $sRoot)
        _GUICtrlStatusBar_SetText($Status, $path, 2)
    Else
        _GUICtrlStatusBar_SetText($Status, "???")
    EndIf
EndFunc

Func _RightClickMenu($hTV)

    ;Create popup menu
    Local $hMenu = _GUICtrlMenu_CreatePopup(8)

    ;Enumerate some values for menu item tracking
    Local Enum $iOption_1 = 1, $iOption_2, $iOption_3, $iOption_4, $iOption_5,$iOption_6,$iOption_7,$iOption_8,$iOption_9
    ;Add menus
    _GUICtrlMenu_AddMenuItem($hMenu, "??", $iOption_1)
    _GUICtrlMenu_AddMenuItem($hMenu, "??", $iOption_2)
    _GUICtrlMenu_AddMenuItem($hMenu, "??", $iOption_3)
    _GUICtrlMenu_AddMenuItem($hMenu, "??", $iOption_4)
    _GUICtrlMenu_AddMenuItem($hMenu, "??", $iOption_5)
    _GUICtrlMenu_AddMenuItem($hMenu, "???", $iOption_6)

    ; Check which item was selected
    Local $mitem = _GUICtrlMenu_TrackPopupMenu($hMenu, $hTV, -1, -1, 1, 1, 2)
    ;Execute menu option
    Switch $mitem
        Case $iOption_1
            _TVnewdir($hTreeView, $hItem, $sRoot)
;           ConsoleWrite('Menu option 1 was selected' & @CRLF)
        Case $iOption_2
            _TVrefresh()
;           ConsoleWrite('Menu Option 2 was selected' & @CRLF)
        Case $iOption_3
            Search()
;           ConsoleWrite('Menu Option 3 was selected' & @CRLF)
        Case $iOption_4
            expand()
;           ConsoleWrite('Menu Option 2 was selected' & @CRLF)
        Case $iOption_5
            Collapse()
        Case $iOption_6
            Rename()
    EndSwitch

    ;free menu resorces
    _GUICtrlMenu_DestroyMenu($hMenu)

EndFunc   ;==>_RightClickMenu

Func Rename()
    $sitem = ControlTreeView($hGUI, "", $h_tree, "GetSelected")
    $str = StringSplit($sitem, "|")
    $sitem = $str[$str[0]]
    $Input1 = InputBox("???treeview?", "????????", $sitem, "", 200, 120)
    If $Input1 <> "" Then
        GUICtrlSetData($sitem, "Rename " & $Input1)
        GUICtrlSetData($sitem, $Input1)
    EndIf
    $sitem = ""
EndFunc

Func Back_Click()
    Local $sPop = _HistoryPoP()
    If $sPop <> -1 Then
      _LVOpen($sPop)
      _LVCombo($sPop)
  EndIf
  ;MsgBox(0,"",$sPop)
EndFunc

Func _LVOpen($sPath)
    $attrib = FileGetAttrib($sPath)
    If $sPath <> "" And $attrib = "D" Then
       $ListView = _IENavigate($oIE, $sPath, 0)
       GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKBOTTOM)
       $hv = WinGetHandle($ListView)
       $hListView = GUICtrlGetHandle($ListView)
       $h_list = ControlGetHandle($hGui, "", $ListView)
       If $PushHistory Then _HistoryPush($sPath)
    EndIf
EndFunc

Func _TVGetPath($hTV, $hItem, $sRoot)

    Local $Path = StringRegExpReplace(_GUICtrlTreeView_GetTree($hTV, $hItem), '([|]+)|(\\[|])', '\\')

    If Not $Path Then
        Return ''
    EndIf
    If Not StringInStr($Path, ':') Then
        Return StringRegExpReplace($sRoot, '(\\[^\\]*(\\|)+)\Z', '\\') & $Path
    EndIf
    Return $Path
EndFunc   ;==>_TVGetPath

Func _TVCombo($hTV)
     _GUICtrlComboBox_BeginUpdate($Input)
     _GUICtrlComboBox_InsertString($Input, _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554), 0)
     _GUICtrlComboBox_EndUpdate($Input)
     _GUICtrlComboBox_SetEditText($Input,_WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554))
     _GUICtrlComboBox_AutoComplete($Input)
     $hSelect = $hItem
EndFunc

Func _LVCombo($sPath)
     _GUICtrlComboBox_BeginUpdate($Input)
     _GUICtrlComboBox_InsertString($Input, $sPath, 0)
     _GUICtrlComboBox_EndUpdate($Input)
     _GUICtrlComboBox_SetEditText($Input,$sPath)
     _GUICtrlComboBox_AutoComplete($Input)
     $hSelect = $hItem
EndFunc

Func _TVRunfile($hTV, $hItem, $sRoot)
    $path = _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554)
    $attrib = FileGetAttrib($path)
    If $path <> "" And $attrib = "D" Then
        _TVCombo($hTV)
    Else
        ShellExecuteWait ($path)
    EndIf
EndFunc

Func _TvLvOpen($hTV, $hItem, $sRoot)
    $sPath = _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554)
    $attrib = FileGetAttrib($sPath)
    If $sPath <> "" And $attrib = "D" Then
       _LVOpen($sPath)
    EndIf
EndFunc

Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam)
    Local $nSize, $pFileName
    Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
    For $i = 0 To $nAmt[0] - 1
        $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
        $nSize = $nSize[0] + 1
        $pFileName = DllStructCreate("char[" & $nSize & "]")
        DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize)
        ReDim $gaDropFiles[$i + 1]
        $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
        $pFileName = 0
    Next
EndFunc   ;==>WM_DROPFILES_FUNC

Func _TVnewdir($hTV, $hItem, $sRoot)
    $path = _WinAPI_PathCompactPath($hInput, _TVGetPath($hTV, $hItem, $sRoot), 554)
    $attrib = FileGetAttrib($path)
    If $path <> "" And $attrib = "D" Then
        $dirname = InputBox("?????", "???????:", "", "")
        RunWait(@ComSpec & " /c " & "MD " & $path & "\" & $dirname,"",@SW_HIDE)

;   MsgBox (0,"??",$TVtext)
    EndIf
EndFunc

Func Search()
    Local $char
    $txt = InputBox("?????","??????:","","")
    $rst = StringInStr($txt,".")
    If $rst = 0 Then
        $txt = $txt & ".doc"
    Else
        $txt = $char
    EndIf
    $hItemFound =  _GUICtrlTreeView_FindItem($hTreeView,$txt)
    If $hItemFound Then
       _GUICtrlTreeView_EnsureVisible($hTreeView,$hItemFound) ;scroll and expand the treeview if needed to get the item visible
       _GUICtrlTreeView_SelectItem($hTreeView,$hItemFound) ;select the item.
;       MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
    Else
        MsgBox(4160, "??", "?????!")
    EndIf

EndFunc

Func expand()
    $txt = ControlTreeView ($hGui, "", $h_tree, "GetSelected")
    ControlTreeView ($hGui, "", $h_tree, "Expand", $txt)
EndFunc

Func Collapse()
    $txt = ControlTreeView ($hGui, "", $h_tree, "GetSelected")
    ControlTreeView ($hGui, "", $h_tree, "Collapse", $txt)
EndFunc

Func open()
    Local $tPoint, $hWnd
    $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData ( $tPoint, "X", MouseGetPos(0))
    DllStructSetData ( $tPoint, "Y", MouseGetPos(1))
    $hWnd = _WinAPI_WindowFromPoint($tPoint)
;   MsgBox(0,"",_WinAPI_GetClassName($hWnd))
    If _WinAPI_GetClassName($hWnd) = "SysListView32" Then
;           ControlClick ($hv, "", "SysListView321")
        $sel = ControlListView($hv, "", "SysListView321", "GetSelected")
        If ControlListView($hv, "", "SysListView321", "IsSelected",$sel) = 1 Then
            $dir = ControlListView($hv, "", "SysListView321", "GetText",$sel)
            $sPath = $sPath & "\" & $dir
            $attrib = FileGetAttrib($sPath)
            If $attrib = "D" Then
                _LVOpen($sPath)
                _LVCombo($sPath)
            EndIf
        Endif
    Endif
;   Sleep(200)
EndFunc

Func _ShowFileProperties($sFile, $sVerb = "properties", $hWnd = 0)
    ; function by Rasim
    ; http://www.autoItscript.com/forum/index....p?showtopic=78236&view=findpos

    Local Const $SEE_MASK_INVOKEIDLIST = 0xC
    Local Const $SEE_MASK_NOCLOSEPROCESS = 0x40
    Local Const $SEE_MASK_FLAG_NO_UI = 0x400

    Local $PropBuff, $FileBuff, $SHELLEXECUTEINFO

    $PropBuff = DllStructCreate("char[256]")
    DllStructSetData($PropBuff, 1, $sVerb)

    $FileBuff = DllStructCreate("char[256]")
    DllStructSetData($FileBuff, 1, $sFile)

    $SHELLEXECUTEINFO = DllStructCreate("int cbSize;long fMask;hwnd hWnd;ptr lpVerb;ptr lpFile;ptr lpParameters;ptr lpDirectory;" & _
            "int nShow;int hInstApp;ptr lpIDList;ptr lpClass;hwnd hkeyClass;int dwHotKey;hwnd hIcon;" & _
            "hwnd hProcess")

    DllStructSetData($SHELLEXECUTEINFO, "cbSize", DllStructGetSize($SHELLEXECUTEINFO))
    DllStructSetData($SHELLEXECUTEINFO, "fMask", $SEE_MASK_INVOKEIDLIST)
    DllStructSetData($SHELLEXECUTEINFO, "hwnd", $hWnd)
    DllStructSetData($SHELLEXECUTEINFO, "lpVerb", DllStructGetPtr($PropBuff, 1))
    DllStructSetData($SHELLEXECUTEINFO, "lpFile", DllStructGetPtr($FileBuff, 1))

    $aRet = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($SHELLEXECUTEINFO))
    If $aRet[0] = 0 Then Return SetError(2, 0, 0)

    Return $aRet[0]
EndFunc   ;==>_ShowFileProperties

Func _exit()
    _GUICtrlStatusBar_Destroy($Status)
    _GUIFrame_Exit()
    Exit
EndFunc

Func _HistoryPush($sDir)
    $HistoryDir = $sDir & '|' & $HistoryDir
EndFunc   ;==>_HistoryPush

Func _HistoryPoP()
    Local $aSplit = StringSplit($HistoryDir, '|', 2)
    If $aSplit[0] = '' Then Return -1
    Local $sReturn = $aSplit[0]
    _ArrayDelete($aSplit, 0)
    $HistoryDir = _ArrayToString($aSplit, '|')
    Return $sReturn
EndFunc   ;==>_HistoryPoP

Func test()
    Local $tPOINT = DllStructCreate("int X;int Y")

    DllStructSetData($tPOINT, "X", MouseGetPos(0))
    DllStructSetData($tPOINT, "Y", MouseGetPos(1))

    _ScreenToClient($hTreeView, $tPOINT)

    Local $iX = DllStructGetData($tPOINT, "X")
    Local $iY = DllStructGetData($tPOINT, "Y")

    Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, $iX, $iY)
    If $iItem <> 0 And _GUICtrlTreeView_Level ($hTreeView, $iItem) = 1 Then
        $index = _GUICtrlTreeView_GetItemParam($hTreeView, $iItem)
        ShellExecute($sPath & _GUICtrlTreeView_GetText($hTreeView, $iItem))
    EndIf
EndFunc

Func _ScreenToClient($hWnd, $tPOINT)
    Local $aRet = DllCall("user32.dll", "int", "ScreenToClient", _
                                                "hwnd", $hTreeView, _
                                                "ptr", DllStructGetPtr($tPOINT))
    Return $aRet[0]
EndFunc;==>_ScreenToClient

If you need help with the contents of the objects and why they are not displaying as you wish, I suggest that you ask Yashied directly as I am not that familiar with his UDF. :idiot:

Are you now content with the GUIFrames part of the script? :)

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

 

  • 3 months later...
Posted (edited)

[New] And finally all 3 files in zip format for those among you who are "cut-and-paste" challenged

Hahaha Me... only coz then I have to insert all of the lew lines and that is really annoying. Thx for this.

EDIT

I have run into a problem. When I call the _GUIFrame_Exit() command, exactly as shown here, the program freezes up and crashes. Is there anything else I should be doing? Or is it a bug in the script?

Edited by Mikeman27294
  • Moderators
Posted

Mikeman27294,

Why are you calling that function anyway? The function header clearly says:

; #INTERNAL_USE_ONLY#==============
; Name...........: _GUIFrame_Exit

So it not supposed to be called directly by the user - the UDF calls it automatically on exit to delete the subclassed separator bars and to free the UDF created WndProc. Which could well be Chinese to you - and is why the function is marked as it is. :huh2:

M23

Note: Dealt with in the OP's own thread.

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

 

  • 2 weeks later...
Posted

Melba23,

After months of distraction I am finally getting around to using this UDF. :) Your examples make using this pretty easy but I have run into one problem.

Can you take a look at this code and see if you can see what I am doing wrong please? I have converted one of your test scripts to use GUIOnEventMode and it all seems to work fine except I cannot seem to set the $GUI_EVENT_CLOSE function.

GUISetOnEvent($GUI_EVENT_CLOSE, 'Close')

Is there something you are doing that would prevent me from using it this way? Here is the whole code file:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

#include "GUIFrame.au3"

Opt("GUIOnEventMode", 1)

Global $iSep_Pos

Main()

While 1
    Sleep (100)
WEnd

Func Main()

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

    ;$iFrameNew = _GUIFrame_Create($hGUI, 1, 50, 3, 0, 0, 0, 0)

    ; Create a 1st level frame
    $iFrame_A = _GUIFrame_Create($hGUI, 0, 0, 3, 0, 20, 0, 0)
    _GUIFrame_SetMin($iFrame_A, 50, 100)

    _GUIFrame_Switch($iFrame_A, 2)
    $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_A, 2))
    $ListView = GUICtrlCreateListView("Column1|Column2", 0, 0, $aWinSize[0], $aWinSize[1] - 20)

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

    _GUIFrame_Switch($iFrame_B, 1)
    $hButton_2 = GUICtrlCreateButton("Close", 10, 10, 50, 30)
    GUICtrlSetOnEvent(-1, "Close")

    ; Create a 3rd level frame
    $iFrame_C = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_B, 2))
    _GUIFrame_Switch($iFrame_C, 2)
    $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_C, 2))
    GUICtrlCreateLabel("", 0, 0, $aWinSize[0], $aWinSize[1])
    GUICtrlSetBkColor(-1, 0xD0D000)

    ; Create a 4th level frame
    $iFrame_D = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_C, 1), 1)
    _GUIFrame_Switch($iFrame_D, 1)
    $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_D, 1))
    GUICtrlCreateLabel("", 0, 0, $aWinSize[0], $aWinSize[1])
    GUICtrlSetBkColor(-1, 0x00FFFF)
    _GUIFrame_Switch($iFrame_D, 2)
    $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_D, 2))
    GUICtrlCreateLabel("", 0, 0, $aWinSize[0], $aWinSize[1])
    GUICtrlSetBkColor(-1, 0xFF00FF)

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

    ; Create a non-resizable 2nd level frame
    $iFrame_E = _GUIFrame_Create(_GUIFrame_GetHandle($iFrame_B, 1), 0, 0, 5, 5, 55, 200, 100)
    _GUIFrame_Switch($iFrame_E, 1)
    $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_E, 1))
    GUICtrlCreateLabel("",  0, 0, $aWinSize[0], $aWinSize[1])
    GUICtrlSetBkColor(-1, 0xFF8000)
    _GUIFrame_Switch($iFrame_E, 2)
    $aWinSize = WinGetClientSize(_GUIFrame_GetHandle($iFrame_E, 2))
    GUICtrlCreateLabel("", 0, 0, $aWinSize[0], $aWinSize[1])
    GUICtrlSetBkColor(-1, 0xD0C0D0)

    GUISetOnEvent($GUI_EVENT_CLOSE, 'Close')




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


EndFunc

Func  Close()
    Exit
EndFunc

Thanks,

cj

Posted

I was able to get this working...

I was setting the Close event for the wrong Gui. I added GUISwitch($hGUI) before the GUISetOnEvent and all is well. Now I just need to rework my WM_Notify function to play nice.

Thanks for a great UDF.

cj

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...