Jump to content
ManneMoses

Change The Size Of The Gui Title Bar?

Recommended Posts

ManneMoses

Hello Guys,

I want to create a simple gui, but with a bigger title bar ( e.g. 2x bigger) Is that possible in any way? I searched the forum but I found nothing. Hope you understand what I mean. Nothing special with the gui, only the size of the title bar should change. Any ideas? Thanks in Advance :D

Edited by ManneMoses

Share this post


Link to post
Share on other sites
Yukoshoo

Are you talking about the Height or the Width of the title bar. Width is easy as you just change the width of the window and the title bar expands with it. I am unsure of how to, and also unsure of why you would want a taller title bar.

Share this post


Link to post
Share on other sites
UEZ

You can use a workaround / proof of concept version like this here:

;build 2015-07-17 beta
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIShellEx.au3>


_GDIPlus_Startup()

;example 1
Global $iHeight_Border = 64
Global $a_hGUI_new = _GDIPlus_BitmapCreateGUITitlebar("Windows 8 Style", 600, 7 * $iHeight_Border, -1, -1, $iHeight_Border, 1, 0, 0, 1, 0xFF2271B3, 0) ;create green titlebar (default is blue)
GUISetBkColor(0x404040)
GUICtrlCreateLabel("This is a test GUI", 10, $iHeight_Border + 8, 380, $iHeight_Border) ;don't forget to calculate the titlebar -> titlebar is from 0 to 64
GUICtrlSetFont(-1, 24, 400, 0, "", 4)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlCreateButton("OK", 500, 7 * $iHeight_Border - 80, 64, 64)
Global $iLV = GUICtrlCreateListView("col1  |col2|col3  ", 16, $iHeight_Border * 2, 568, 3 * $iHeight_Border)
For $i = 1 to 50
    GUICtrlCreateListViewItem("item" & $i + 1 & "|col2" & $i + 1 & "|col2" & $i + 1, $iLV)
Next
GUISetState()

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $a_hGUI_new[1]
            GUIDelete($a_hGUI_new[0])
            ExitLoop
        Case $a_hGUI_new[2]
            GUISetState(@SW_MINIMIZE, $a_hGUI_new[0])
    EndSwitch
Until False

;example 2
$iHeight_Border = 48
$a_hGUI_new = _GDIPlus_BitmapCreateGUITitlebar("Windows XP Style", 600, 7 * $iHeight_Border, -1, -1, $iHeight_Border, 0)
GUISetBkColor(0x404040)
GUICtrlCreateLabel("This is a test GUI", 10, $iHeight_Border + 8, 380, $iHeight_Border)
GUICtrlSetFont(-1, 24, 400, 0, "", 4)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlCreateButton("OK", 500, 7 * $iHeight_Border - 80, 64, 64)
Global $iLV = GUICtrlCreateListView("col1  |col2|col3  ", 16, $iHeight_Border * 2, 568, 3 * $iHeight_Border)
For $i = 1 to 50
    GUICtrlCreateListViewItem("item" & $i + 1 & "|col2" & $i + 1 & "|col2" & $i + 1, $iLV)
Next
GUISetState()

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $a_hGUI_new[1]
            GUIDelete($a_hGUI_new[0])
            _GDIPlus_Shutdown()
            Exit
        Case $a_hGUI_new[2]
            GUISetState(@SW_MINIMIZE, $a_hGUI_new[0])
    EndSwitch
Until False

Func _GDIPlus_BitmapCreateGUITitlebar($sTitle, $iWidth, $iHeight, $iLeft = -1, $iRight = -1, $iHeight_Border = 29, $iTitleAlign = 1, $iHue = 0, $iAmount = 0, $bFlatColor = False, $iFlatColor = 0xFF2271B3, $bRoundTopCorners = True, $iBorderTextColor = 0xFFF0F0F0, $hParent = Null)
    $iHue = $iHue > 180 ? 180 : $iHue < -180 ? -180 : $iHue
    $iAmount = $iAmount > 100 ? 100 : $iAmount < -100 ? -100 : $iAmount
    $iLeft = Int($iLeft)
    $iRight = Int($iRight)
    $iTitleAlign = $iTitleAlign > 2 ? 2 : $iTitleAlign < 0 ? 0 : $iTitleAlign
    Local Const $_hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iLeft, $iRight, $WS_POPUPWINDOW, Default, $hParent)
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight_Border)
    Local Const $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetInterpolationMode($hGraphic, 7)
    _GDIPlus_GraphicsSetTextRenderingHint($hGraphic, 4)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4)
    Local $iCornerWidth = Ceiling($iHeight_Border / 6)
    If Not $bFlatColor Then
        Local $hBmp = _GDIPlus_BitmapCreateFromMemory(_WTB())
        Local Const $iW = _GDIPlus_ImageGetWidth($hBmp), $iH = _GDIPlus_ImageGetHeight($hBmp)
        If $bRoundTopCorners Then _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBmp, 0, 0, $iCornerWidth, $iH, 0, 0, $iCornerWidth, $iHeight_Border)
        _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBmp, $iCornerWidth, 0, $iW - 2 * $iCornerWidth, $iH, $iCornerWidth * $bRoundTopCorners, 0, $iWidth - 2 * $iCornerWidth * $bRoundTopCorners, $iHeight_Border)
        If $bRoundTopCorners Then _GDIPlus_GraphicsDrawImageRectRect($hGraphic, $hBmp, $iW - $iCornerWidth, 0, $iCornerWidth, $iH, $iWidth - $iCornerWidth, 0, $iCornerWidth, $iHeight_Border)
    Else
        Local $hBrush_Flat = _GDIPlus_BrushCreateSolid($iFlatColor)
        _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight_Border, $hBrush_Flat)
        _GDIPlus_BrushDispose($hBrush_Flat)
    EndIf
    If @OSBuild > 7599 And Not $bFlatColor Then
        Local Const $hEffect = _GDIPlus_EffectCreateTint($iHue, $iAmount)
        _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect)
        _GDIPlus_EffectDispose($hEffect)
    EndIf
    Local Const $hBrush_Text = _GDIPlus_BrushCreateSolid($iBorderTextColor)
    Local $tLayout = _GDIPlus_RectFCreate(3.5 * $iCornerWidth, $iCornerWidth / 2, $iWidth - 10.5 * $iCornerWidth, $iHeight_Border - $iCornerWidth)
    Local Const $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, $iTitleAlign)
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    Local Const $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local Const $hFont = _GDIPlus_FontCreate($hFamily, $iHeight_Border / 3)
    Local $c = -1
    Do
        $c += 1
    Until _GDIPlus_GraphicsMeasureString($hGraphic, StringMid($sTitle, 1, StringLen($sTitle) - $c), $hFont, $tLayout, $hFormat)[2] = 1
    _GDIPlus_GraphicsDrawStringEx($hGraphic, StringMid($sTitle, 1, StringLen($sTitle) - $c - 3 * (Not $c ? 0 : 1)) & ($c > 0 ? "..." : ""), $hFont, $tLayout, $hFormat, $hBrush_Text)
    Local $hHBitmap_WinTitlebar = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    If Not $bFlatColor Then _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_BrushDispose($hBrush_Text)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    Local Const $iPic_Titlebar = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight_Border)
    GUICtrlSetState(-1, $GUI_DISABLE)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_Titlebar, 0x0172, $IMAGE_BITMAP, $hHBitmap_WinTitlebar)) ; $STM_SETIMAGE = 0x0172
    If $bRoundTopCorners Then
        Local Const $iYCap = _WinAPI_GetSystemMetrics($SM_CYCAPTION), $iFrame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)
        Local Const $hRegion = _WinAPI_CreateRoundRectRgn(0, 0, $iWidth + $iFrame, $iHeight + 2 * $iYCap, $iCornerWidth * 4, $iCornerWidth * 4)
        _WinAPI_SetWindowRgn($_hGUI, $hRegion)
        _WinAPI_DeleteObject($hRegion)
    EndIf
    _WinAPI_DeleteObject($hHBitmap_WinTitlebar)
    Local Const $iX_Right = 44
    Local $iLbl_Move = GUICtrlCreateLabel("", 0, 0, $iWidth - $iX_Right - 58, $iHeight_Border, -1, $GUI_WS_EX_PARENTDRAG)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Local Const $iClose = GUICtrlCreateLabel("x", $iWidth - $iX_Right, 4, ($bFlatColor ? 40 : 24), 24, BitOR($SS_CENTERIMAGE, $SS_CENTER), (Not $bFlatColor ? $WS_EX_STATICEDGE : -1))
    GUICtrlSetBkColor(-1, 0xE04343)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 14, 800, 0, "", 4)
    Local Const $iMax = GUICtrlCreateLabel(ChrW(0x274F), $iWidth - $iX_Right - 32, 2, 24, 24, BitOR($SS_CENTERIMAGE, $SS_CENTER), (Not $bFlatColor ? $WS_EX_STATICEDGE : -1))
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 16, 400, 0, "", 4)
    GUICtrlSetState(-1, $GUI_DISABLE)
    Local Const $iMin = GUICtrlCreateLabel(ChrW(822), $iWidth - $iX_Right - 56, 6, 24, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER), (Not $bFlatColor ? $WS_EX_STATICEDGE : -1))
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetFont(-1, 16, 800, 0, "", 4)
    Local Const $hIcon = _WinAPI_ShellExtractIcon(@AutoItExe, 0, 16, 16)
    Local Const $iPic_WinIcon = GUICtrlCreatePic("", 1.5 * $iCornerWidth, 1.5 * $iCornerWidth, 16, 16)
    $hBmp = _GDIPlus_BitmapCreateFromHICON32($hIcon)
    Local Const $hHBitmap_WinTitlebar_Icon = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_WinIcon, 0x0172, $IMAGE_BITMAP, $hHBitmap_WinTitlebar_Icon)) ; $STM_SETIMAGE = 0x0172
    _GDIPlus_BitmapDispose($hBmp)
    _WinAPI_DeleteObject($hHBitmap_WinTitlebar_Icon)
    Local Const $a_hGUI[5] = [$_hGUI, $iClose, $iMin, $iMax, $iPic_WinIcon]
    _WinAPI_DestroyIcon($hIcon)
    Return $a_hGUI
EndFunc

;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2015-03-02

Func _WTB($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $WTB
    $WTB &= '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'
    $WTB &= '4+PO01bAGgGVqaFZ5UAI64pR4N5Wqa06KgheUPVIJ3wbPBykonBK7ROUw8cDy8RbyUXDmLAppoLso8Acbhz+WIbQ2QbeAE/3G2cYEkxhAcGJGBsKCNaEyYtg3WSIG9ColpGWg+nsYQBp0NDoIaRNrzIUqgKihmJFslIo57LrtAl+Ze227G+z7Tm2PmtNkHRaao5gFZsrizX0Db4DwYsgXtCamIiuSUpWtCRgHiUVsGqtsLYt1p2p6EaUSnO1Y4DsI0zVpzSY7iQpc76UoYUelMHBEzDk8nTuRWxhQ5ccKYJbQJAWhJK1SVs2hCYFj70eaKG1G6Tp52iv8LOuTcyw6VvUxVUtc622q8wZb2WczdpDzUlKX+KWZGVVpH486ZKgSFYD4VZ/wlej6c1UWoIceJPcCHmbzu42zEvz45z99rr+OLcmWuHG2gD5sueTzmltiBZaJjI+KziPLEnNetjqFqvOyaH+aTwGMc/6slb3l3oTIlYxNz20l17hKLnX84XkA17nJYSlKUMWA6Qq8pJhKklvf1TLP3Ikx5L3bCy8AJH2AKZWMLtFGwDSvp9x1Mqs35ljiRy3iPvwAFOhYoKUSl4REjwF/Pi0Jm/eb5q1Y2+MjmWKqPUaLXCoHTqy/qcslZokZyulK6tUbSz2wWHzrylr081q1A8l+rQH37Fn6OLrutzHB/gZ8NM/YfSIyLKXPJxWHfehKf2Dpchtpun10Dq6HbukEkQ8W8HuXaBpyqSuYWr+nzbZac5rNbo0b4u4z7pG6vEE3D/TFRj9YgkteuDm82GSIjeYuvwh0t8vj8vK6YVe7A9qFG6Mte9uu3Z3zf35BI+fDAE38V8l6bEWS8bogQAAAABJRU5ErkJggg=='
    Local $bString = _WinAPI_Base64Decode($WTB)
    If @error Then Return SetError(1, 0, 0)
    $bString = Binary($bString)
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\Windows Title Bar1.png", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_WTB

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

This looks like the old WinXP titlebar and I tested it only on Win8. The hover has to be implemented manually.

 

The tint effect reqires GDIPlus v1.1!

Edited by UEZ
Example extended a little bit more

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
ManneMoses

Are you talking about the Height or the Width of the title bar. Width is easy as you just change the width of the window and the title bar expands with it. I am unsure of how to, and also unsure of why you would want a taller title bar.

I mean the height, sorry i forgot to say

Share this post


Link to post
Share on other sites
ManneMoses

Thank you Uez, it works! But is there no easier way to do this? 

Share this post


Link to post
Share on other sites
UEZ

This is a fake title bar. I don't know whether it is possible to change that height for default GUI!
At the first glance it might look complicated but if you spend some time to understand the idea behind this fake title bar it will be much easier to understand.
If you have question don't hesitate to ask here.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
JohnOne

Thank you Uez, it works! But is there no easier way to do this? 

GUICreate("GUI", 200, 200, 100, 100, 0x80880000) ; 0x80880000 = $WS_POPUPWINDOW
GUICtrlCreateLabel("Title Bar", 0, 0, 160, 40, -1, 0x00100000) ; 0x00100000 = $GUI_WS_EX_PARENTDRAG
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetColor(-1, 0xFFFFFF)
$Close = GUICtrlCreateButton("X", 160, 0, 40, 40)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)

While 3
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Close
            Exit
    EndSwitch
WEnd

You wanted easy.

Alternatively, use a picture instead of a label and or button.

  • Like 1

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
reb

@JohnOne

I like that.

Centered text in label

;~ Name:   JohnOne
;~ URL:    https://www.autoitscript.com/forum/topic/173672-change-the-size-of-the-gui-title-bar/#comment-1257450
#include <WindowsConstants.au3>

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
;~ Local $GUI_WS_EX_PARENTDRAG
GUICreate("GUI", 200, 200, 100, 100, 0x80880000) ; 0x80880000 = $WS_POPUPWINDOW
$TitleBar = GUICtrlCreateLabel("Title Bar", 0, 0, 160, 40,BitOR($SS_CENTER,$SS_CENTERIMAGE),0x00100000) ;$GUI_WS_EX_PARENTDRAG) ; 0x00100000 = $GUI_WS_EX_PARENTDRAG  , -1
GUICtrlSetBkColor(-1, 0x0000FF)
GUICtrlSetColor(-1, 0xFFFFFF)
$Close = GUICtrlCreateButton("X", 160, 0, 40, 40,$WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont($TitleBar,10,600)
GUISetState(@SW_SHOW)

While 3
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Close
            Exit
    EndSwitch
WEnd

 

  • Like 1

MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites
jguinch

I'm not sure, but you can try _WinAPI_DwmExtendFrameIntoClientArea

 

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

If Not _WinAPI_DwmIsCompositionEnabled() Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later with enabled Aero theme.')
    Exit
EndIf

Local $hForm = GUICreate('Test', 400, 400)
GUICtrlCreateLabel("", 0, 82, 400, 318, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateButton("Button", 10, 100, 200, 25)

GUISetBkColor(0)
_WinAPI_DwmExtendFrameIntoClientArea($hForm, _WinAPI_CreateMargins(0, 0, 82, 2))


GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

Edited by jguinch
  • Like 1

Share this post


Link to post
Share on other sites
ManneMoses

I'm not sure, but you can try _WinAPI_DwmExtendFrameIntoClientArea

 

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

If Not _WinAPI_DwmIsCompositionEnabled() Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later with enabled Aero theme.')
    Exit
EndIf

Local $hForm = GUICreate('Test', 400, 400)
GUICtrlCreateLabel("", 0, 82, 400, 318, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetState(-1, $GUI_DISABLE)

GUICtrlCreateButton("Button", 10, 100, 200, 25)

GUISetBkColor(0)
_WinAPI_DwmExtendFrameIntoClientArea($hForm, _WinAPI_CreateMargins(0, 0, 82, 2))


GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

Thank you man, this is awesome! Exactly what i wanted, thanks!!

Share this post


Link to post
Share on other sites
ManneMoses

I modified the script from jguinch a little a this came out ( Not useful, but in my opinion this looks awesome )

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




Local $GUI = GUICreate('ok', 700, 700, -1, -1, BitXOR($WS_SIZEBOX, $WS_POPUP, $WS_MINIMIZEBOX), -1, WinGetHandle(AutoItWinGetTitle()))
Global Const $SC_DRAGMOVE = 0xF012
GUICtrlSetState(-1, $GUI_DISABLE)
WinSetOnTop( "ok", "", 1 )
GUISetBkColor(0)
_WinAPI_DwmExtendFrameIntoClientArea($gui, _WinAPI_CreateMargins(0, 0, 2000, 2))

    GUISetState(@SW_SHOW, $GUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
         Case $GUI_EVENT_PRIMARYDOWN
             _SendMessage($GUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
        EndSwitch
    WEnd

 

Share this post


Link to post
Share on other sites
UEZ

That will work only properly on Vista / Win7 when Aero is enabled.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

  • Similar Content

    • Emmhor1
      By Emmhor1
      Hi All,

      MAIN QUESTION:
      Is it possible to Call specific function within a GUI

      So I have a script with multiple functions although I don't want to use every function every time.
      My Idea is to create a simple GUI which allows me to select what functions I want to use then run the funtions by clicking a button.
      I have already made a GUI which allows me to select specific .exe's I would like to run after selection it runs the .exe one by one.
      This script is on my work laptops and cannot access it right now.
       
      Who can help me with this?
      GUIcreate
      Func1 
      Func2
      Func3
      Then have a boxes which allows me to select the specif Func.(I used GUIChecked and Unchecked in my other script)
      Then a button which executes/calls the selected functions
    • Blois
      By Blois
      Hi Guis,
       
      I need to create keyboard shortcut to navigate the tabs and activate them, but I could not use the code below:
      #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> #include <GUIConstantsEx.au3> HotKeySet("^{TAB}", "_TabRight") HotKeySet("^+{TAB}", "_TabLeft") $gui = GUICreate("test",450, 300) $Tab1 = GUICtrlCreateTab(20, 24, 425, 201) $TabSheet1 = GUICtrlCreateTabItem("Tabsheet 1") $lbContagemGrupos2 = GUICtrlCreateLabel("aaaa", 50, 50) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateTabItem("") $TabSheet2 = GUICtrlCreateTabItem(" ") $TabSheet3 = GUICtrlCreateTabItem(" ") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _TabRight() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos + 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Func _TabLeft() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos - 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Exit  
      can you help me?
    • Pricehacker
      By Pricehacker
      Hello again!
      I have tried searching for quite some time now but couldn´t find a single working way to change the class of your GUI that doesn´t include changing it manually after its compilation.
      First or "AutoIt v3 GUI" is a pretty boring name tbh and i would like to spice it up a bit, also, and more importantly, I would like to identify my windows by something other than its title as it will change depending on some factors and im using two different programs independently as multi threading isn't supported.
      Any help is appreciated! Thank you!
    • xtcislove
      By xtcislove
      Hello, 
      i have a Problem with  _WinAPI_SetLayeredWindowAttributes, everything is working as excepted if u are on Windows 7.

      But if u are on Windows 10 the transparent background of a control is not clickable anymore. 

      Could someone help?

      Please see example below, put cmd.jpg into the same folder as Example.au3

      Please see trigger.jpg to see which sections are not clickable in Windows 10 (the red dots, the green dots are clickable) on Windows 7 the red ones and green ones are clickable.
       
      The same problem occurs if i use 
       
       
      Example.au3


    • WilliamasKumeliukas
      By WilliamasKumeliukas
      Hello everyones reading this post,
      I'm struggling at resizing properly my radio buttons to fit long text inside without affecting others radio buttons and also adjust position of them relative to the string.
      I tried with _StringSize UDF but I guess im too tired to figure out how to use it correctly..
      I also tried: _Control_SetWidth2Text I found on this forum, it work aslong im not maximizing GUI (radio text is gone when I maximize and maximize is a must)
       
      here is the code example, I hope someone can figure out (sorry if guictrlsetpos is not included in the example, I know thats probably the way to go but I wanted to make sure there is nothing better before use it)
      Thank you
       
      Br,
      ~WilliamasKumeliukas
       
      #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <Array.au3> #include <StringConstants.au3> #include <FileConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <EditConstants.au3> #include <GUIListBox.au3> #include <ButtonConstants.au3> #include <ProgressConstants.au3> #include <ColorConstants.au3> #include <AutoitConstants.au3> #include <Misc.au3> #include <WinAPIReg.au3> #include <WinAPI.au3> #Region Opt's Opt("GUIResizeMode", 802) #EndRegion Opt's Global $q = "INTRO LINE" & @CRLF & @CRLF & "description of everything until user press start." Global $file = @TempDir & "\test.p" destroy() Global $msg, $score = 0, $rate, $com, $total = 0, $cfile, $cq, $i = 0, $time = 0, $min = 0, $sec = 0, $hour = 0, $qf, $ii = 0 Main() Func Main() Global $iGUIInitSize = 550 #Region GUI Opt("GUICloseOnEsc", 1) Global $gui = GUICreate("example", 1124, 550,-1 ,-1, BitOR($WS_MAXIMIZEBOX , $WS_MINIMIZEBOX)) Global $gui_size = WinGetClientSize($gui) Global $iFontSize = Int(2 * (.25 + (8 * $gui_size[0] / $iGUIInitSize))) / 2 Global $options = GUICtrlCreateMenu("&Options") Global $guide = GUICtrlCreateMenuItem("Guide", $options) Global $restart = GUICtrlCreateMenuItem("Restart", $options) Global $about = GUICtrlCreateMenuItem("About", $options) Global $exit = GUICtrlCreateMenuItem("Exit", $options) Global $extra = GUICtrlCreateMenu("Extras") Global $creator = GUICtrlCreateMenu("CQB", $extra ) Global $new = GUICtrlCreateMenuItem("custom QP", $creator) Global $load = GUICtrlCreateMenuItem("CQ", $creator ) Global $timer = GUICtrlCreateLabel("", 752, 472, 294, 30, $WS_BORDER) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER) ) GUICtrlSetFont(-1, $iFontSize) GUICtrlSetState($timer, $GUI_HIDE) Global $info = GUICtrlCreateLabel( $q, 200, 20, 700, 200, $SS_CENTER ) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER) ) $fi = GUICtrlSetFont($info, $iFontSize) Global $a = GUICtrlCreateRadio("A)", 100, 210, $WS_EX_CLIENTEDGE) $fa = GUICtrlSetFont($a, 15) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER) ) GUICtrlSetState($a, 16) Global $b = GUICtrlCreateRadio("B)", 100, 310 , $WS_EX_CLIENTEDGE) $fb = GUICtrlSetFont($b, 15) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER) ) GUICtrlSetState($b, 16) Global $c = GUICtrlCreateRadio("C)", 750, 210 , $WS_EX_CLIENTEDGE) $fc = GUICtrlSetFont($c, 15) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER) ) GUICtrlSetState($c, 16) Global $d = GUICtrlCreateRadio( "D) ", 750, 310, $WS_EX_CLIENTEDGE) $fd = GUICtrlSetFont($d, 15) GUICtrlSetResizing (-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER) ) GUICtrlSetState($d, 16) Global $sign = GUICtrlCreateLabel( $file, 420, 480, -1, -1, BitOR ( $SS_CENTER, $WS_BORDER ) ) GUICtrlSetResizing ( -1, BitOR ( $GUI_DOCKHCENTER, $GUI_DOCKVCENTER ) ) GUICtrlSetFont($sign, 12) Global $yb = GUICtrlCreateRadio("True", 200, 420, 200, 50, $BS_PUSHLIKE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER,$GUI_DOCKSIZE)) GUICtrlSetFont($yb, 15) GUICtrlSetState($yb, 32) Global $nb = GUICtrlCreateRadio("False", 700, 420, 200, 50, $BS_PUSHLIKE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER, $GUI_DOCKSIZE)) GUICtrlSetFont($nb, 15) GUICtrlSetState($nb, 32) Global $start = GUICtrlCreateButton("Start", 20, 20, 100, 50, $SS_CENTER, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) GUICtrlSetFont($start, 12) Global $valid = GUICtrlCreateButton("Confirm", 20, 20, 100, 50, $SS_CENTER, $WS_EX_CLIENTEDGE) GUICtrlSetResizing(-1, BitOR($GUI_DOCKHCENTER, $GUI_DOCKVCENTER)) GUICtrlSetFont($valid, 12) GUICtrlSetState($valid, 32) GUISetState(@SW_SHOW) #EndRegion GUI While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Switch MsgBox(4096 + 4, "Warning", "Are you sure to exit?") Case 6 AdlibUnRegister("timer") If Not $qf = "" Then FileClose($file) EndIf Exit Case 7 ContinueLoop EndSwitch Case $start ;AdlibRegister("timer") ;Global $qf = StringSplit(StringStripWS(FileRead($file), 6), @CRLF, 0) ;qloop($file) GUICtrlSetData($a, "A) This long string is an example as string that I want to fit in 4 radio buttons because sometimes it can be that long.") GUICtrlSetData($b, "B) This long string is an example as string that I want to fit in 4 radio buttons because sometimes it can be that long.") GUICtrlSetData($c, "C) This long string is an example as string that I want to fit in 4 radio buttons because sometimes it can be that long.") GUICtrlSetData($d, "D) This long string is an example as string that I want to fit in 4 radio buttons because sometimes it can be that long.") Case $restart MsgBox(4096, "Warning", 'Normally, your suposed to start something before restarting it.') ContinueLoop Case $new ;GUISetState(@SW_HIDE, $gui) ;_CustomNew() ContinueLoop Case $load ;_CustomLoad() Case $about ;_About() EndSwitch WEnd EndFunc ;Main() Func timer() If $time = 0 Then Global $time = TimerInit() Global $diff = TimerDiff($time) Global $sec = Int(Mod($diff / 1000, 60)) Global $min = Int(Mod($diff / 60000, 60)) Global $hour = Int($diff / 3600000) If $sec < 10 Then $sec = "0" & $sec If $min < 10 Then $min = "0" & $min If $hour < 10 Then $hour = "0" & $hour GUICtrlSetData($timer, "Temps: " & $hour & ":" & $min & ":" & $sec) EndFunc ;==>timer Func destroy() If FileExists($file) Then FileDelete($file) EndIf DirCreate(@TempDir & "\About") FileInstall("C:\test.txt", $file) EndFunc ;==>destroy  
×