Sign in to follow this  
Followers 0
MacScript

How to resize a transparent borderless popup

6 posts in this topic

#1 ·  Posted (edited)

I have been looking for the forums and searching the internet a good portion of today.

I have a popup that is borderless and transparent and I need a way to resize this gui (it also must be movable. which it is currently).

I have included script snippet with my existing window that is transparent and borderless.

Thanks ahead of time for any suggestions.

#include <GuiConstantsEx.au3>
#include <Windowsconstants.au3>
#include <SendMessage.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPISys.au3>
#include <GuiRichEdit.au3>
#include <GuiEdit.au3>
 HotKeySet("{ESC}", "On_Exit")


maingui()

Func MainGui()
    $st1 = $WS_POPUP
    $st2 = BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)
    Local $iHorizontal = 1
    Global $hGUIMain = GUICreate("Test", 500, 200, -1, -1, $WS_POPUP, $st2) ;-31A- (took ; off)
    Global $lblDragMe = GUICtrlCreateLabel("Move", $iHorizontal, 1, 35, 21)
    GUICtrlSetBkColor($lblDragMe, 0xD4D0C8)
    guictrlsetfont($lblDragMe, 10)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $btnMenuOpen = GUICtrlCreateButton("Menu", $iHorizontal ,1,35,21)
    GUICtrlSetResizing($btnMenuOpen, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $btnGetFile = GUICtrlCreateButton("File", $iHorizontal,1,35,21)
    GUICtrlSetResizing($btnGetFile, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $cmbMainOpt = GUICtrlCreateCombo("", $iHorizontal, 1, 70, 21)
    GUICtrlSetResizing($cmbMainOpt, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 70
    Global $btnExit = GUICtrlCreateButton("Exit", $iHorizontal,1,35,21)
    GUICtrlSetResizing($btnExit, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $hRichEdit = _GUICtrlRichEdit_Create($hGUIMain, "", 1, 23, 498, 166, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY), $WS_EX_TRANSPARENT) ;-24-
    _GUICtrlEdit_SetReadOnly($hRichEdit, True)
    GUICtrlSetResizing($hRichEdit, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    GUISetBkColor(0xABCDEF, $hGUIMain)
    _WinAPI_SetLayeredWindowAttributes($hGUIMain, 0xABCDEF, 250)
    GUISetState(@SW_SHOW, $hGUIMain) ; Makes GUI Visible
EndFunc

 Func On_Exit()
    Exit
 EndFunc

 While 1
        Switch GUIGetMsg()
                Case $GUI_EVENT_PRIMARYDOWN
                    _SendMessage($hGUIMain, $WM_SYSCOMMAND, 0xF012, 0)
                EndSwitch
     Sleep(10)
 WEnd
Edited by MacScript

Share this post


Link to post
Share on other sites



MacScript,

That was fun! :D

Because there is no GUI visible to set resizing borders, I do not believe any of the usual tricks (as described in the Moving and Resizing PopUp GUIs tutorial in the Wiki) will work. So I have taken a different approach - clicking the label replaces the transparent GUI with one you can drag and resize. When you have it as you want, a rightclick brings up a context menu which allows you to accept or reject the new position/size: ;)

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global $hResize_GUI
; Set distance from edge of Resize_GUI where resizing is possible
Global Const $iMargin = 4
; Set max and min Resize_GUI sizes
Global Const $iGUIMinX = 150, $iGUIMinY = 100, $iGUIMaxX = 600, $iGUIMaxY = 400

_Main()

Func _Main()

   ; Create GUI
    Local $hMain_GUI = GUICreate("Select Rectangle", 300, 200, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))

    Local $cAction = GUICtrlCreateLabel("Move/Resize", 0, 0, 80, 30)
    GUICtrlSetBkColor($cAction, 0xD4D0C8)
    GUICtrlSetResizing($cAction, $GUI_DOCKAUTO)
    Local $hExit_Button = GUICtrlCreateButton("Exit", 220, 170, 80, 30)
    GUICtrlSetResizing($cAction, $GUI_DOCKAUTO)

    GUISetBkColor(0xABCDEF, $hMain_GUI)
    _WinAPI_SetLayeredWindowAttributes($hMain_GUI, 0xABCDEF, 250)

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $hExit_Button
                Exit
            Case $cAction
                GUISetState(@SW_HIDE, $hMain_GUI)
                ; Get present coords
                Local $aCoords = WinGetPos($hMain_GUI)
                ; Get new coords
                $aCoords = _Action_GUI($aCoords)
                ; Move and resize main GUI
                WinMove($hMain_GUI, "", $aCoords[0], $aCoords[1], $aCoords[2], $aCoords[3])
                GUISetState(@SW_SHOW, $hMain_GUI)
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; -------------

Func _Action_GUI($aCoords)

    ; Create resize GUI

    $hResize_GUI = GUICreate("Y", $aCoords[2], $aCoords[3], $aCoords[0], $aCoords[1], $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
    GUISetBkColor(0xABCDEF)

    ; Create label for dragging
    Local $cLabel = GUICtrlCreateLabel("", $iMargin * 2, $iMargin * 2,  $aCoords[2] - ($iMargin * 4),  $aCoords[3] - ($iMargin * 4), -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)

    ; Create context menu
    Local $cContextMenu = GUICtrlCreateContextMenu($cLabel)
    $cContext_Action = GUICtrlCreateMenuItem("Action", $cContextMenu)
    $cContext_Cancel = GUICtrlCreateMenuItem("Cancel", $cContextMenu)

    ; Hide GUI
    _WinAPI_SetLayeredWindowAttributes($hResize_GUI, 0xABCDEF, 250)

    GUISetState()

    ; Set transparency level
    WinSetTrans($hResize_GUI, "", 100)

    ; Register message handlers
    GUIRegisterMsg($WM_MOUSEMOVE, "_SetCursor") ; For cursor type change
    GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") ; For resize/drag
    GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO") ; For GUI size limits

    While 1

        Switch GUIGetMsg()
            Case $cContext_Action
                ; Get GUI position and delete
                $aCoords = WinGetPos($hResize_GUI)
                ExitLoop
            Case $cContext_Cancel
                ExitLoop
        EndSwitch
    WEnd

    GUIDelete($hResize_GUI)
    ; Unregister message handlers
    GUIRegisterMsg($WM_MOUSEMOVE, "")
    GUIRegisterMsg($WM_LBUTTONDOWN, "")
    GUIRegisterMsg($WM_GETMINMAXINFO, "")

    Return $aCoords

EndFunc   ;==>$cContext_Action

; Set cursor to correct resizing form if mouse is over a border
Func _SetCursor()
    Local $iCursorID
    Switch _Check_Border()
        Case 0
            $iCursorID = 2
        Case 1, 2
            $iCursorID = 13
        Case 3, 6
            $iCursorID = 11
        Case 5, 7
            $iCursorID = 10
        Case 4, 8
            $iCursorID = 12
    EndSwitch
    GUISetCursor($iCursorID, 1)
EndFunc   ;==>_SetCursor

; Check cursor type and resize/drag window as required
Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    Local $iCursorType = _Check_Border()
    If $iCursorType > 0 Then ; Cursor is set to resizing style so send appropriate resize message
        $iResizeType = 0xF000 + $iCursorType
        _SendMessage($hResize_GUI, $WM_SYSCOMMAND, $iResizeType, 0)
    EndIf
EndFunc   ;==>_WM_LBUTTONDOWN

; Determines if mouse cursor over a border
Func _Check_Border()
    Local $aCurInfo = GUIGetCursorInfo($hResize_GUI)
    Local $aWinPos = WinGetPos($hResize_GUI)
    Local $iSide = 0
    Local $iTopBot = 0
    If $aCurInfo[0] < $iMargin Then $iSide = 1
    If $aCurInfo[0] > $aWinPos[2] - $iMargin Then $iSide = 2
    If $aCurInfo[1] < $iMargin Then $iTopBot = 3
    If $aCurInfo[1] > $aWinPos[3] - $iMargin Then $iTopBot = 6
    Return $iSide + $iTopBot
EndFunc   ;==>_Check_Border

; Set min and max GUI sizes
Func _WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
    $tMinMaxInfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tMinMaxInfo, 7, $iGUIMinX)
    DllStructSetData($tMinMaxInfo, 8, $iGUIMinY)
    DllStructSetData($tMinMaxInfo, 9, $iGUIMaxX)
    DllStructSetData($tMinMaxInfo, 10, $iGUIMaxY)
    Return 0
EndFunc   ;==>_WM_GETMINMAXINFO
Any use? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Hi Melba23-

Yes this has use and can I just say LOL. Cause I came up with similar idea while sleeping and wrote it all up on a pad of paper that was on nightstand and from the time stamp of your posting it was just around same time you posted :).

So here is my version, just using a normal gui with border to do the resizing. I am not sure which was is better to go with. Would like suggestions from the experienced.

Also when I right click on your code I can not move the original window around.

#include <GuiConstantsEx.au3>
#include <Windowsconstants.au3>
#include <SendMessage.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPISys.au3>
#include <GuiRichEdit.au3>
#include <GuiEdit.au3>
 HotKeySet("{ESC}", "On_Exit")


maingui()

Func MainGui()
    $st1 = $WS_POPUP
    $st2 = BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)
    Local $iHorizontal = 1
    Global $hGUIMain = GUICreate("Move/resize Pop-Borderless-Trans", 500, 200, -1, -1, $WS_POPUP, $st2) ;-31A- (took ; off)
    Global $lblDragMe = GUICtrlCreateLabel("Move", $iHorizontal, 1, 35, 21)
    GUICtrlSetBkColor($lblDragMe, 0xD4D0C8)
    guictrlsetfont($lblDragMe, 10)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $btnMenuOpen = GUICtrlCreateButton("Resize", $iHorizontal ,1,35,21)
    GUICtrlSetResizing($btnMenuOpen, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $btnGetFile = GUICtrlCreateButton("File", $iHorizontal,1,35,21)
    GUICtrlSetResizing($btnGetFile, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $cmbMainOpt = GUICtrlCreateCombo("", $iHorizontal, 1, 70, 21)
    GUICtrlSetResizing($cmbMainOpt, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 70
    Global $btnExit = GUICtrlCreateButton("Exit", $iHorizontal,1,35,21)
    GUICtrlSetResizing($btnExit, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    $iHorizontal = $iHorizontal + 35
    Global $hRichEdit = _GUICtrlRichEdit_Create($hGUIMain, "", 1, 23, 498, 166, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY), $WS_EX_TRANSPARENT) ;-24-
    _GUICtrlEdit_SetReadOnly($hRichEdit, True)
    GUICtrlSetResizing($hRichEdit, $GUI_DOCKLEFT + $GUI_DOCKTOP)
    GUISetBkColor(0xABCDEF, $hGUIMain)
    _WinAPI_SetLayeredWindowAttributes($hGUIMain, 0xABCDEF, 250)
    GUISetState(@SW_SHOW, $hGUIMain) ; Makes GUI Visible
EndFunc

Func GuiSizer()
    $st1 = $WS_POPUP
    $st2 = BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST)
    WinActivate($hGUIMain, "")  ;Gui Menu location
    ;//Capture the RFCalculator Window x y position
    Local $Handle = WinGetHandle($hGUIMain, "")
    $RFScreenPos = WinGetPos($Handle, "")

    $hGUISizer = GUICreate("Size me for chat", $RFScreenPos[2], $RFScreenPos[3], $RFScreenPos[0], $RFScreenPos[1], BitXOr($WS_BORDER, $WS_POPUP, $WS_SIZEBOX), $st2)
    Local $lblDragMe = GUICtrlCreateLabel("Adjust Size of Window for chat", 2, 1, 200, 21)
    guictrlsetfont($lblDragMe, 10)

    local $btnSizerFinished = Guictrlcreatebutton("Finished", 2, 22, 50, 21)

    GUISetBkColor(0xABCDEF, $hGUISizer)
    _WinAPI_SetLayeredWindowAttributes($hGUISizer, 0xABCDEF, 250)
    GUISetState(@SW_SHOW, $hGUISizer) ; Makes GUI Visible
    GUISetState(@SW_HIDE, $hGUIMain) ; Makes GUI Visible

    While 1
        Switch GUIGetMsg()
            Case $btnSizerFinished
                $Handle = WinGetHandle($hGUISizer, "")
                $RFScreenPos = WinGetPos($Handle, "")
                WinMove($hGUIMain, "", $RFScreenPos[0],$RFScreenPos[1] , $RFScreenPos[2], $RFScreenPos[3])
                GUIDelete($hGUISizer)
                GUISetState(@SW_SHOW, $hGUIMain) ; Makes GUI Visible
                ExitLoop
            Case $GUI_EVENT_PRIMARYDOWN
                local $tmphnd = WinGetHandle("")
                if $tmphnd = $hGUISizer Then
                    _SendMessage($hGUISizer, $WM_SYSCOMMAND, 0xF012, 0)
                EndIf
        EndSwitch
    WEnd
EndFunc

Func On_Exit()
    GUIDelete($hGUIMain)
    Exit
EndFunc

 While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_PRIMARYDOWN
                _SendMessage($hGUIMain, $WM_SYSCOMMAND, 0xF012, 0)
            Case $btnMenuOpen
                GuiSizer()
            Case $btnExit
                On_Exit()
        EndSwitch
     Sleep(10)
 WEnd

Share this post


Link to post
Share on other sites

MacScript,

They do say that "great minds think alike"! :D

My version removed the ability to drag via the label - you needed to use the other GUI for both movement and resizing (the label read "Move/Resize"). Either way of doing it seems fine to me - I suggest you use the technique you prefer. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Thanks Melba23

One other question, is there an easy way to switch my window from transparent to not-transparent by clicking a button?

Share this post


Link to post
Share on other sites

MacScript,

I would just change the background colour of the GUI so that it is no longer considered transparent - something like this:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global $hResize_GUI
; Set distance from edge of Resize_GUI where resizing is possible
Global Const $iMargin = 4
; Set max and min Resize_GUI sizes
Global Const $iGUIMinX = 150, $iGUIMinY = 100, $iGUIMaxX = 600, $iGUIMaxY = 400
; Flag for GUI colour
$bColour = True

_Main()

Func _Main()

   ; Create GUI
    Local $hMain_GUI = GUICreate("Select Rectangle", 300, 200, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))

    Local $cAction = GUICtrlCreateLabel("Move/Resize", 0, 0, 80, 30)
    GUICtrlSetBkColor($cAction, 0xD4D0C8)
    GUICtrlSetResizing($cAction, $GUI_DOCKAUTO)

    Local $cColour = GUICtrlCreateButton("Colour", 0, 40, 80, 30)
    GUICtrlSetResizing($cAction, $GUI_DOCKAUTO)

    Local $hExit_Button = GUICtrlCreateButton("Exit", 220, 170, 80, 30)
    GUICtrlSetResizing($cAction, $GUI_DOCKAUTO)

    GUISetBkColor(0xABCDEF, $hMain_GUI)
    _WinAPI_SetLayeredWindowAttributes($hMain_GUI, 0xABCDEF, 250)

    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $hExit_Button
                Exit
            Case $cColour
                ; Toggle colour
                $bColour = Not $bColour
                If $bColour Then
                    GUISetBkColor(0xABCDEF, $hMain_GUI) ; Makes it transparent
                Else
                    GUISetBkColor(0xABCDEE, $hMain_GUI) ; Makes it visible
                EndIf
            Case $cAction
                GUISetState(@SW_HIDE, $hMain_GUI)
                ; Get present coords
                Local $aCoords = WinGetPos($hMain_GUI)
                ; Get new coords
                $aCoords = _Action_GUI($aCoords)
                ; Move and resize main GUI
                WinMove($hMain_GUI, "", $aCoords[0], $aCoords[1], $aCoords[2], $aCoords[3])
                GUISetState(@SW_SHOW, $hMain_GUI)
        EndSwitch
    WEnd

EndFunc   ;==>_Main

; -------------

Func _Action_GUI($aCoords)

    ; Create resize GUI

    $hResize_GUI = GUICreate("Y", $aCoords[2], $aCoords[3], $aCoords[0], $aCoords[1], $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
    GUISetBkColor(0xABCDEF)

    ; Create label for dragging
    Local $cLabel = GUICtrlCreateLabel("", $iMargin * 2, $iMargin * 2,  $aCoords[2] - ($iMargin * 4),  $aCoords[3] - ($iMargin * 4), -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)

    ; Create context menu
    Local $cContextMenu = GUICtrlCreateContextMenu($cLabel)
    $cContext_Action = GUICtrlCreateMenuItem("Action", $cContextMenu)
    $cContext_Cancel = GUICtrlCreateMenuItem("Cancel", $cContextMenu)

    ; Hide GUI
    _WinAPI_SetLayeredWindowAttributes($hResize_GUI, 0xABCDEF, 250)

    GUISetState()

    ; Set transparency level
    WinSetTrans($hResize_GUI, "", 100)

    ; Register message handlers
    GUIRegisterMsg($WM_MOUSEMOVE, "_SetCursor") ; For cursor type change
    GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") ; For resize/drag
    GUIRegisterMsg($WM_GETMINMAXINFO, "_WM_GETMINMAXINFO") ; For GUI size limits

    While 1

        Switch GUIGetMsg()
            Case $cContext_Action
                ; Get GUI position and delete
                $aCoords = WinGetPos($hResize_GUI)
                ExitLoop
            Case $cContext_Cancel
                ExitLoop
        EndSwitch
    WEnd

    GUIDelete($hResize_GUI)
    ; Unregister message handlers
    GUIRegisterMsg($WM_MOUSEMOVE, "")
    GUIRegisterMsg($WM_LBUTTONDOWN, "")
    GUIRegisterMsg($WM_GETMINMAXINFO, "")

    Return $aCoords

EndFunc   ;==>$cContext_Action

; Set cursor to correct resizing form if mouse is over a border
Func _SetCursor()
    Local $iCursorID
    Switch _Check_Border()
        Case 0
            $iCursorID = 2
        Case 1, 2
            $iCursorID = 13
        Case 3, 6
            $iCursorID = 11
        Case 5, 7
            $iCursorID = 10
        Case 4, 8
            $iCursorID = 12
    EndSwitch
    GUISetCursor($iCursorID, 1)
EndFunc   ;==>_SetCursor

; Check cursor type and resize/drag window as required
Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    Local $iCursorType = _Check_Border()
    If $iCursorType > 0 Then ; Cursor is set to resizing style so send appropriate resize message
        $iResizeType = 0xF000 + $iCursorType
        _SendMessage($hResize_GUI, $WM_SYSCOMMAND, $iResizeType, 0)
    EndIf
EndFunc   ;==>_WM_LBUTTONDOWN

; Determines if mouse cursor over a border
Func _Check_Border()
    Local $aCurInfo = GUIGetCursorInfo($hResize_GUI)
    Local $aWinPos = WinGetPos($hResize_GUI)
    Local $iSide = 0
    Local $iTopBot = 0
    If $aCurInfo[0] < $iMargin Then $iSide = 1
    If $aCurInfo[0] > $aWinPos[2] - $iMargin Then $iSide = 2
    If $aCurInfo[1] < $iMargin Then $iTopBot = 3
    If $aCurInfo[1] > $aWinPos[3] - $iMargin Then $iTopBot = 6
    Return $iSide + $iTopBot
EndFunc   ;==>_Check_Border

; Set min and max GUI sizes
Func _WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
    $tMinMaxInfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tMinMaxInfo, 7, $iGUIMinX)
    DllStructSetData($tMinMaxInfo, 8, $iGUIMinY)
    DllStructSetData($tMinMaxInfo, 9, $iGUIMaxX)
    DllStructSetData($tMinMaxInfo, 10, $iGUIMaxY)
    Return 0
EndFunc   ;==>_WM_GETMINMAXINFO

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0