Search the Community

Showing results for tags 'borderless gui'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Chat
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 2 results

  1. Features: Create modern looking borderless and resizable GUIs with control buttons (Close,Maximize/Restore,Minimize, Fullscreen, Menu) True borderless, resizeable GUI with full support for aerosnap etc. Many color schemes/themes included. See MetroThemes.au3 for more details. 3 type of Windows 8/10 style buttons. Modern checkboxes, radios, toggles and progressbar. All buttons, checkboxes etc. have hover effects! Windows 10 style modern MsgBox. Windows 10/Android style menu that slides in from left. Windows 10 style right click menu Credits: @UEZ, for the function to create buttons with text using GDIPlus. @binhnx for his SSCtrlHover UDF Version 5.0.0.1 - Changelog - 07.10.2017 Bugfixes: Fixed a bug where certain controls in the GUI (Tabs/Listviews) were not handled properly because of a bug in _WinAPI_DefSubclassProc. Thanks @LarsJ. Removed the automated handling of the control buttons (except for fullscreen), as they were triggering the close/min/max/restore message multiple times when the user clicked them on the child window multiple times during a sleep, which caused the parent window to also receive the message. Fixed a bug where in certain situations the active child window prevented the fullscreen activation from working properly on the parent window. Fixed a bug where the resize cursor was not displayed properly when hovering over the corners. -> Currently it is required to reset the cursor to default if you use any controls very close to the window border and move your mouse from the corner to the control. I will try to think of something later. Fixed a bug where the lines of the _Metro_AddControlButton_Back were misplaced on certain DPI settings. Also fixed the hover not working with this button. Other small changes New features: Added _Metro_AddHSeperator/_Metro_AddVSeperator to create simple vertical/horizontal seperator lines in the GUI. Version 5.0 - Changelog - 03.09.2017 New features: Hover effects, minimize,maximize,restore and other GUI effects are now working natively, there is no need to call any function in a loop. This also allows the hover effects to work if the main script is paused due to "Sleep, Msgbox etc." The hover effects now work slightly faster and create less CPU usage, however the startup time of the main script is slightly increased. Thanks to @binhnx for his SSCtrlHover UDF. Maximize, Minimize, Fullscreen and Restore buttons now work natively, meaning you don't need to set actions for them manually. If you prefer handling the buttons manually, then you can disable this by setting "$ControlBtnsAutoMode = False" Added _Metro_CreateButtonEx2 -> Creates a slightly rounded button without a frame around. Hovering changes the button color to a lighter color. Added _Metro_CreateCheckboxEx2 -> Creates a modern round checkbox. Added _Metro_CreateRadioEx -> Creates a metro style radio with colored checkmark. Added "_Metro_RightClickMenu" an easy to use rightclick menu. You can use this with listviews or anything else. Check out the example for a demo of the rightclick menu and how to implement it. -> Rightclick on Button3 to show the menu. Added multiple new themes with flat colors and updated the old themes. Check out the example for a demo with all themes by pressing the menu button -> Themes Demo Improvements: You can now delete all controls that have hover effects(buttons, checkboxes etc.) using GUICtrlDelete($ControlHandle). This will also automatically release all resources and remove the control from the global array. Many other optimizations,changes and bugfixes. Download UDF with example:
  2. So i needed a way of creating borderless resizable, dragable GUIs while maintaining the AeroSnap(or whatever it is called now) functionality of Windows. The problem was that creating $WS_POPUP GUIs killed the AeroSnap functionality of Windows, it also caused @SW_Maximize to go fullscreen instead of just maximizing. I found some examples of borderless GUIs for C++, the solution was really easy: WM_NCCALCSIZE I have collected some other examples of resizing and dragging borderless GUIs, tweaked them a and wrote a simple to use UDF with easy usage with just one line: _GUI_EnableDragAndResize($Form1) Example with UDF: #include <Windowsconstants.au3> #include <WinAPIGdi.au3> Global $GLOBAL_MAIN_GUI, $Win_Min_ResizeX = 145, $Win_Min_ResizeY = 45 #region Example $Form1 = GUICreate("Example GUI", 300, 150, -1, -1, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX)) GUISetBkColor(0x282828, $Form1) _GUI_EnableDragAndResize($Form1,300, 150) $Button1 = GUICtrlCreateButton("Exit", 90, 60, 120, 30) GUICtrlSetResizing(-1, 768 + 8 + 128) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case -3, $Button1 Exit EndSwitch #cs uncomment this if you have a very large listview or any other control that is very close to the gui borders, this makes sure the resize cursor gets reset properly. If WinActive($Form1) Then Local $mgetinfo = MouseGetCursor(), $aMouseInfo = GUIGetCursorInfo($Form1) If ($mgetinfo = 12) Or ($mgetinfo = 11) Or ($mgetinfo = 10) Or ($mgetinfo = 13) Then If Not ($aMouseInfo[4] = 0) Then GUISetCursor(2, 1) EndIf EndIf #ce WEnd #endregion Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUI_EnableDragAndResize ; Compatibility .: Windows 7 and above. Not tested on XP. ; Description ...: Removes the Borders of a GUI, allows drag and resize while keeping the AeroSnap features of Windows still working with the GUI ; Warning .......: Can only be called for one GUI, if you call if for a second GUI, you have to call _GUI_DragAndResizeUpdate($Form1) it for the first GUI after closing the second GUI. ; Syntax ........: _GUI_EnableDragAndResize($mGUI, $GUI_WIDTH, $GUI_HEIGHT [, $Min_ResizeX = $Win_Min_ResizeX[, $Min_ResizeY = $Win_Min_ResizeY[, ; $AddShadowEffect = True]]]) ; Parameters ....: $mGUI - Handle to your GUI. ; $GUI_WIDTH - The width of the GUI. (Required to fix the wrong size after removing borders) ; $GUI_HEIGHT - The height of the GUI. (Required to fix the wrong size after removing borders) ; $Min_ResizeX - [optional] Min size of the GUI. Default is 145 ; $Min_ResizeY - [optional] Max size of the GUI. Default is 45 ; $$AddShadowEffect - [optional] Adds shadow effect that looks like a thin border. Works only with Aero-Effects enabled. Default is False ; Author ........: BB_19 ; Credits .......: https://www.autoitscript.com/wiki/Moving_and_Resizing_PopUp_GUIs ; Example .......: _GUI_EnableDragAndResize($Form1,300,200) ; =============================================================================================================================== Func _GUI_EnableDragAndResize($mGUI, $GUI_WIDTH, $GUI_HEIGHT, $Min_ResizeX = $Win_Min_ResizeX, $Min_ResizeY = $Win_Min_ResizeY, $AddShadowEffect = False) Global $GLOBAL_MAIN_GUI = $mGUI, $Win_Min_ResizeX = $Min_ResizeX, $Win_Min_ResizeY = $Min_ResizeY GUIRegisterMsg(0x0024, "INTERNAL_WM_GETMINMAXINFO") ; For GUI size limits GUIRegisterMsg(0x0084, "INTERNAL_WM_NCHITTEST") ; For resizing and to allow doubleclick to maximize and drag on the upper GUI. GUIRegisterMsg(0x0083, "INTERNAL_WM_NCCALCSIZE") ; To Prevent window border from drawing GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN") ; For drag/GUI moving. Disable this if you want to only a specific the area for dragging.(By using labels with $GUI_WS_EX_PARENTDRAG) GUIRegisterMsg(0x0005, "INTERNAL_WM_SIZING") ; Fixing the maxmized position (otherwise we have a -7px margin on all sides due to the missing border) GUIRegisterMsg(0x0086, "INTERNAL_WM_NCACTIVATE") ; Prevent Windowframe from redrawing when window goes inactive If $AddShadowEffect = True Then Local $tMargs = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight") DllStructSetData($tMargs, 1, 1) DllStructSetData($tMargs, 2, 1) DllStructSetData($tMargs, 3, 1) DllStructSetData($tMargs, 4, 1) DllCall("dwmapi.dll", "int", "DwmExtendFrameIntoClientArea", "hwnd", $mGUI, "ptr", DllStructGetPtr($tMargs)) EndIf WinMove($mGUI, "", Default, Default, $GUI_WIDTH, $GUI_HEIGHT);Update Size and EndFunc ;==>_GUI_EnableDragAndResize ;Update drag and resize for your first GUI after using _GUI_EnableDragAndResize on a second GUI. Func _GUI_DragAndResizeUpdate($mGUI, $Min_ResizeX = $Win_Min_ResizeX, $Min_ResizeY = $Win_Min_ResizeY) Global $GLOBAL_MAIN_GUI = $mGUI, $Win_Min_ResizeX = $Min_ResizeX, $Win_Min_ResizeY = $Min_ResizeY GUIRegisterMsg(0x0024, "INTERNAL_WM_GETMINMAXINFO") GUIRegisterMsg(0x0084, "INTERNAL_WM_NCHITTEST") GUIRegisterMsg(0x0083, "INTERNAL_WM_NCCALCSIZE") GUIRegisterMsg(0x0201, "INTERNAL_WM_LBUTTONDOWN") GUIRegisterMsg(0x0005, "INTERNAL_WM_SIZING") GUIRegisterMsg(0x0086, "INTERNAL_WM_NCACTIVATE") EndFunc ;==>_GUI_EnableDragAndResizeUpdate ;Prevent Borders from redrawing when window goes inactive Func INTERNAL_WM_NCACTIVATE($hWnd, $iMsg, $wParam, $lParam) If ($hWnd = $GLOBAL_MAIN_GUI) Then Return -1 EndFunc ;==>INTERNAL_WM_NCACTIVATE ;Fix maximized position Func INTERNAL_WM_SIZING($hWnd, $iMsg, $wParam, $lParam) If ($hWnd = $GLOBAL_MAIN_GUI) Then If (WinGetState($GLOBAL_MAIN_GUI) = 47) Then Local $WorkingSize = _GetDesktopWorkArea($GLOBAL_MAIN_GUI) Local $aWinPos = WinGetPos($GLOBAL_MAIN_GUI) _WinAPI_SetWindowPos($GLOBAL_MAIN_GUI, $HWND_TOP, $aWinPos[0] - 1, $aWinPos[1] - 1, $WorkingSize[2], $WorkingSize[3], $SWP_NOREDRAW) EndIf EndIf EndFunc ;==>INTERNAL_WM_SIZING ; Set min and max GUI sizes Func INTERNAL_WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam) $tMinMaxInfo = DllStructCreate("int;int;int;int;int;int;int;int;int;dword", $lParam) Local $WorkingSize = _GetDesktopWorkArea($GLOBAL_MAIN_GUI) ;Prevent Windows from misplacing the GUI when maximized, due to missing borders. DllStructSetData($tMinMaxInfo, 3, $WorkingSize[2]) DllStructSetData($tMinMaxInfo, 4, $WorkingSize[3]) DllStructSetData($tMinMaxInfo, 5, $WorkingSize[0] + 1) DllStructSetData($tMinMaxInfo, 6, $WorkingSize[1] + 1) ;Min Size limits DllStructSetData($tMinMaxInfo, 7, $Win_Min_ResizeX) DllStructSetData($tMinMaxInfo, 8, $Win_Min_ResizeY) Return 0 EndFunc ;==>INTERNAL_WM_GETMINMAXINFO ;Stop drawing GUI Borders Func INTERNAL_WM_NCCALCSIZE($hWnd, $Msg, $wParam, $lParam) If $hWnd = $GLOBAL_MAIN_GUI Then Return 0 EndIf Return 'GUI_RUNDEFMSG' EndFunc ;==>INTERNAL_WM_NCCALCSIZE ;Set mouse cursor for resizing etc. / Allow the upper GUI (40 pixel from top) to act as a control bar (doubleclick to maximize, move gui around..) Func INTERNAL_WM_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) If ($hWnd = $GLOBAL_MAIN_GUI) Then Local $iSide = 0, $iTopBot = 0, $CurSorInfo Local $mPos = MouseGetPos() Local $aWinPos = WinGetPos($GLOBAL_MAIN_GUI) Local $aCurInfo = GUIGetCursorInfo($GLOBAL_MAIN_GUI) ;Check if Mouse is over Border, Margin = 5 If Not @error Then If $aCurInfo[0] < 5 Then $iSide = 1 If $aCurInfo[0] > $aWinPos[2] - 5 Then $iSide = 2 If $aCurInfo[1] < 5 Then $iTopBot = 3 If $aCurInfo[1] > $aWinPos[3] - 5 Then $iTopBot = 6 $CurSorInfo = $iSide + $iTopBot Else $CurSorInfo = 0 EndIf ;Set position for drag and doubleclick to maximize $xMIN = $aWinPos[0] + 4 $xMAX = $aWinPos[0] + $aWinPos[2] - 4 $yMIN = $aWinPos[1] + 4 $yMAX = $aWinPos[1] + 40 If ($mPos[0] >= $xMIN) And ($mPos[0] <= $xMAX) And ($mPos[1] >= $yMIN) And ($mPos[1] <= $yMAX) Then GUISetCursor(2, 1) Return 2; Return $HTCAPTION if mouse is within the position for drag + doubleclick to maximize EndIf If Not (WinGetState($GLOBAL_MAIN_GUI) = 47) Then ;Set resize cursor and return the correct $HT for gui resizing If ($aCurInfo[4] = 0) Then Local $Return_HT = 2, $Set_Cursor = 2 Switch $CurSorInfo Case 1 $Set_Cursor = 13 $Return_HT = 10 Case 2 $Set_Cursor = 13 $Return_HT = 11 Case 3 $Set_Cursor = 11 $Return_HT = 12 Case 4 $Set_Cursor = 12 $Return_HT = 13 Case 5 $Set_Cursor = 10 $Return_HT = 14 Case 6 $Set_Cursor = 11 $Return_HT = 15 Case 7 $Set_Cursor = 10 $Return_HT = 16 Case 8 $Set_Cursor = 12 $Return_HT = 17 EndSwitch GUISetCursor($Set_Cursor, 1) If Not ($Return_HT = 2) Then Return $Return_HT EndIf EndIf EndIf Return 'GUI_RUNDEFMSG' EndFunc ;==>INTERNAL_WM_NCHITTEST ; Allow drag with mouse left button down Func INTERNAL_WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) If ($hWnd = $GLOBAL_MAIN_GUI) Then If Not (WinGetState($GLOBAL_MAIN_GUI) = 47) Then Local $aCurInfo = GUIGetCursorInfo($GLOBAL_MAIN_GUI) If ($aCurInfo[4] = 0) Then ; Mouse not over a control DllCall("user32.dll", "int", "ReleaseCapture") DllCall("user32.dll", "long", "SendMessage", "hwnd", $GLOBAL_MAIN_GUI, "int", 0x00A1, "int", 2, "int", 0) EndIf EndIf EndIf EndFunc ;==>INTERNAL_WM_LBUTTONDOWN ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetDesktopWorkArea ; Description ...: Calculate the desktop workarea for a specific window to maximize it. Supports multi display and taskbar detection. ; Syntax ........: _GetDesktopWorkArea($hWnd) ; Parameters ....: $hWnd - Handle to the window. ; Return values .: Array in following format: ; : [0] = X-Pos for maximizing ; : [1] = Y-Pos for maximizing ; : [2] = Max. Width ; : [3] = Max. Height ; Author ........: BB_19 ; Note ..........: The x/y position is not the real position of the window if you have multi display. It is just for setting the maximize info for WM_GETMINMAXINFO ; =============================================================================================================================== Func _GetDesktopWorkArea($hWnd) Local $MonitorSizePos[4], $MonitorNumber = 1 $MonitorSizePos[0] = 0 $MonitorSizePos[1] = 0 $MonitorSizePos[2] = @DesktopWidth $MonitorSizePos[3] = @DesktopHeight ;Get Monitors Local $aPos, $MonitorList = _WinAPI_EnumDisplayMonitors() If @error Then Return $MonitorSizePos If IsArray($MonitorList) Then ReDim $MonitorList[$MonitorList[0][0] + 1][5] For $i = 1 To $MonitorList[0][0] $aPos = _WinAPI_GetPosFromRect($MonitorList[$i][1]) For $j = 0 To 3 $MonitorList[$i][$j + 1] = $aPos[$j] Next Next EndIf ;Check on which monitor our window is Local $GUI_Monitor = _WinAPI_MonitorFromWindow($hWnd) ;Check on which monitor the taskbar is Local $Taskbar_Monitor = _WinAPI_MonitorFromWindow(WinGetHandle("[CLASS:Shell_TrayWnd]")) ;Write the width and height info of the correct monitor into an array For $iM = 1 To $MonitorList[0][0] Step +1 If $MonitorList[$iM][0] = $GUI_Monitor Then $MonitorSizePos[0] = 0 $MonitorSizePos[1] = 0 $MonitorSizePos[2] = $MonitorList[$iM][3] $MonitorSizePos[3] = $MonitorList[$iM][4] $MonitorNumber = $iM EndIf Next ;Check if Taskbar autohide is enabled, if so then we will remove 1px from the correct side so that the taskbar will reapear when moving mouse to the side Local $TaskBarAutoHide = DllCall("shell32.dll", "int", "SHAppBarMessage", "int", 0x00000004, "ptr*", 0) If Not @error Then $TaskBarAutoHide = $TaskBarAutoHide[0] Else $TaskBarAutoHide = 0 EndIf ;Check if Taskbar is on this Monitor, if so, then recalculate the position, max. width and height of the WorkArea If $Taskbar_Monitor = $GUI_Monitor Then $TaskBarPos = WinGetPos("[CLASS:Shell_TrayWnd]") If @error Then Return $MonitorSizePos ;Win 7 classic theme compatibility If ($TaskBarPos[0] = $MonitorList[$MonitorNumber][1] - 2) Or ($TaskBarPos[1] = $MonitorList[$MonitorNumber][2] - 2) Then $TaskBarPos[0] = $TaskBarPos[0] + 2 $TaskBarPos[1] = $TaskBarPos[1] + 2 $TaskBarPos[2] = $TaskBarPos[2] - 4 $TaskBarPos[3] = $TaskBarPos[3] - 4 EndIf If ($TaskBarPos[0] = $MonitorList[$MonitorNumber][1] - 2) Or ($TaskBarPos[1] = $MonitorList[$MonitorNumber][2] - 2) Then $TaskBarPos[0] = $TaskBarPos[0] + 2 $TaskBarPos[1] = $TaskBarPos[1] + 2 $TaskBarPos[2] = $TaskBarPos[2] - 4 $TaskBarPos[3] = $TaskBarPos[3] - 4 EndIf ;Recalc width/height and pos If $TaskBarPos[2] = $MonitorSizePos[2] Then If $TaskBarAutoHide = 1 Then If ($TaskBarPos[1] > 0) Then $MonitorSizePos[3] -= 1 Else $MonitorSizePos[1] += 1 $MonitorSizePos[3] -= 1 EndIf Return $MonitorSizePos EndIf $MonitorSizePos[3] = $MonitorSizePos[3] - $TaskBarPos[3] If ($TaskBarPos[0] = $MonitorList[$MonitorNumber][1]) And ($TaskBarPos[1] = $MonitorList[$MonitorNumber][2]) Then $MonitorSizePos[1] = $TaskBarPos[3] Else If $TaskBarAutoHide = 1 Then If ($TaskBarPos[0] > 0) Then $MonitorSizePos[2] -= 1 Else $MonitorSizePos[0] += 1 $MonitorSizePos[2] -= 1 EndIf Return $MonitorSizePos EndIf $MonitorSizePos[2] = $MonitorSizePos[2] - $TaskBarPos[2] If ($TaskBarPos[0] = $MonitorList[$MonitorNumber][1]) And ($TaskBarPos[1] = $MonitorList[$MonitorNumber][2]) Then $MonitorSizePos[0] = $TaskBarPos[2] EndIf EndIf Return $MonitorSizePos EndFunc ;==>_GetDesktopWorkArea Download UDF with seperate example: BorderLessWinUDF.zip EDIT: Newest versions of this UDF with bugfixes can be downloaded from the MetroGUI project: