Jump to content
ManneMoses

Change The Size Of The Gui Title Bar?

Recommended Posts

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

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

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

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

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

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.

Share this post


Link to post
Share on other sites

@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

 


MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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

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

    • By coronatuss
      Hello eveyone,
      I installed the latest version of Autoit (x86 - for greater compatibility) and SciTE.
      Every time I want to generate the GUI code designed in Koda, the program freezes (only Koda, not SciTE).
      Have you ever had this problem? Do you know how to fix it?
      Thanks!
    • By rudi
      Hello,
       
      I found a couple of threads asking quite similar questions, but without finding a "straight" solution to Access the internal phone storage as well as the plugged in SD-Card.
       
      While the SD Card is quite an easy Job (shutdown phone, remove SD, plug into some Card Reader, Access it using a drive letter), the internal storage isn't accessible this way.
       
      Of course I *CAN* Access all the (regular visible) Content, when connected to a Windows box.
       
      But this way I cannot estimate, where all the space was eaten up. So I'd like to know, how to address the "root" Folder of the internal storage of my Android Phone to get it's subfolders and files. Going through the whole Folder tree recursively isn't my Problem, it's just howto address the very first Folder and then to read all files (with sizes) and names of the subfolders.
       
       
      Regards, Rudi.
    • By nacerbaaziz
      hello sirs, i've created a tool to the blind users, this tool helps the blind to listen to a audio effect when moving between the GUIs controls on they computers
      where this tool can get the class for the current focus control and play a sound from a folder
      i've added all the knowne classes, but i found some problems i hope any one can help me.
      this is the code that i created

      #include <WinAPISys.au3> Global $h_CurrentHWNDFocus = "", $h_CurrentControlHWNDFocus = "" AdlibRegister("WindowAudioFocus", 50) Func WindowAudioFocus()     Local $h_NewHWNDFocus = WinGetHandle("[active]", "")     Local $h_NewControlHWNDFocus = ControlGetFocus($h_NewHWNDFocus, "")     If ($h_NewHWNDFocus = $h_CurrentHWNDFocus) And ($h_NewControlHWNDFocus = $h_CurrentControlHWNDFocus) Then Return 0     AdlibUnRegister("WindowAudioFocus")     If Not ($h_NewHWNDFocus = $h_CurrentHWNDFocus) Then         SoundPlay(@ScriptDir & "\focus_Audio\WindowChanged.wav")     Else         Switch _WinAPI_GetClassName(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus))             Case "Button", "Start", "TrayButton", "TrayShowDesktopButtonWClass", "sbutton", "CirrussButton", "ODbcButton", "ThunderRTCommandButton", "ThunderSSOption", "ThunderSSCommand", "ThunderCommandButton", "ThunderRT6CommandButton", "ThunderRT5CommandButton", "TButton", "TBitBtn", "TAdvGlowButton", "ButtonWndClass", "afx:0:376:baa946", "_AOL_Button"                 If _IsCheckBox(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then                     SoundPlay(@ScriptDir & "\focus_Audio\checkBox.wav")                 ElseIf _IsRadio(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then                     SoundPlay(@ScriptDir & "\focus_Audio\radio.wav")                 Else                     SoundPlay(@ScriptDir & "\focus_Audio\button.wav")                 EndIf             Case "ComboBox", "ComboBoxEx32", "MSOBALLOONREComboBox20W", "REComboBox20W", "ThunderComboBox", "ThunderDriveListBox", "ThunderRT6ComboBox", "TORComboEdit", "TCombobox", "TComboBoxEx", "TORComboBox", "TColorBox", "TNFComboBox", "Internet Explorer_TridentCmbobx", "ComboWndClass", "_AOL_ComboBox", "ThunderRT5ComboBox", "ComboLBox"                 SoundPlay(@ScriptDir & "\focus_Audio\list.wav")             Case "Edit", "SearchBox", "TChatRichEdit", "_WwN", "_WwO", "RichEdit20A", "RichEdit20WPT", "RICHEDIT60W", "OKttbx", "RichEditA", "ThunderTextBox", "ThunderRT6TextBox", "ThunderRT5TextBox", "TEdit", "TRichEdit", "TRichEditViewer", "TMemo", "TInplaceEditList", "TLabeledEdit", "TMaskEdit", "TDateTimePicker", "TRichEdit", "TCaptionMemo", "TAddictRichEdit", "TCaptionEdit", "RichTextWndClass", "TextWndClass", "PasswordWndClass", "TextAreaWndClass", "MSWorksDoc", "_AOL_Edit", "SysDateTimePick32"                 SoundPlay(@ScriptDir & "\focus_Audio\edit.wav")             Case "ListBox", "ComboLBox", "REListBox20W", "SUPERGRID", "OUTEXVLB", "WMSUIVLB", "SchdmapiVLB", "VLBClass", "ThunderDirListBox", "ThunderFileListBox", "ThunderListBox", "ThunderRT6ListBox", "ThunderRT5ListBox", "TListbox", "TValueListEditor", "TORCalendar", "TColorListBox", "TCheckListBox", "Internet Explorer_TridentLstBox", "ListBoxWndClass", "ListWndClass", "hh_kwd_vlist", "afx:8:376:0:946", "_AOL_ListBox", "_AOL_Tree", ""                 SoundPlay(@ScriptDir & "\focus_Audio\List.wav")             Case "SysListView32", "OpenListView", "wuDuiListView", "ListView20WndClass", "TcxGridSite", "TListView", "TSystemListView", "ListViewWndClass", ""                 SoundPlay(@ScriptDir & "\focus_Audio\ListView.wav")             Case "SysTreeView32", "SearchTreeList", "FeatureTree", "TreeView20WndClass", "TSystemTreeView", "TTreeView", ""                 SoundPlay(@ScriptDir & "\focus_Audio\TreeView.wav")             Case Else                 SoundPlay(@ScriptDir & "\focus_Audio\focus.wav")         EndSwitch     EndIf     $h_CurrentHWNDFocus = $h_NewHWNDFocus     $h_CurrentControlHWNDFocus = $h_NewControlHWNDFocus     AdlibRegister("WindowAudioFocus", 50)     Return 1 EndFunc   ;==>WindowAudioFocus Func _IsCheckBox($ctrl_hwnd)     $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)     Return BitAND($Style, $BS_CHECKBOX) = $BS_CHECKBOX EndFunc   ;==>_IsCheckBox Func _IsRadio($ctrl_hwnd)     $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)     Return BitAND($Style, $BS_AUTORADIOBUTTON) = $BS_AUTORADIOBUTTON EndFunc   ;==>_IsRadio
      what i need from you is :
      play a sound when a menu item focus, that sound named menu.wav
      play a sound named items.wav when the users move on list box items or list view or treeview items or a combobox items
      please if can any one help me i'll very happy
      thanks on advance
    • By nacerbaaziz
      hello sirs, please i created a tool witch get the focused control in a window and play a audio file linked with this controls
      e.g buttons, checkBoxes, radios, comboboxes, and others
      i know that their is a function that give us the control focus but it return the classNN
      i want to get the class name to use it with a switch and
      because their are more than class e.g button tbutton timagebutton tnewButton...
      please can any one help me to get the class name not the classnn
      thanks in advance
    • By CarlD
      Update: Download the latest version here.
      As my first stab at GUI scripting, I'm trying to write a simple graphical interface for Grep for Windows. I have a basic GUI, but I'm stuck on one point and nothing I've tried so far works. The sticking point is that while the Tab key works to move focus from one input control to the next, clicking the mouse on any but the first input does nothing. This seems like a basic feature of GUI functionality that should work out of the box (like Tab), but clearly I'm missing something. I tried (among many other things) Melba23's technique in the post below, but this doesn't do what I'm after -- getting the left click to set the insertion point for user input. Would greatly appreciate a pointer or two. 😉
      Here's my code so far:
      ; Grep for Windows -- GUI [CLD] #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("WinTitleMatchMode", -2) #cs FileInstall("X:\nix\search1.ico", @TempDir & "\search1.ico") FileInstall("X:\nix\grep.exe", @TempDir & "\grep.exe") FileInstall("X:\nix\sed.exe", @TempDir & "\sed.exe") FileInstall("X:\nix\libiconv2.dll", @TempDir & "\libiconv2.dll") FileInstall("X:\nix\libintl3.dll", @TempDir & "\libintl3.dll") FileInstall("X:\nix\pcre3.dll", @TempDir & "\pcre3.dll") FileInstall("X:\nix\regex2.dll", @TempDir & "\regex2.dll") #ce ; $sDefFs = @ScriptDir & "\.txt" $sOut = "" $iX = 20 $iY = 20 $hgGGrep = GUICreate("Grep for Windows: Simple TeXT search", 600, 600) GUISetState(@SW_SHOW, $hgGGrep) ; Obtain value of control: GUICtrlRead() ; left, top, width, height ; $iX, $iY, $iX + n, $iY + m ; $hgIco = GUICtrlCreateIcon(@ScriptDir & "\search1.ico", $iX, $iY, 10) $hgGL0 = GUICtrlCreateLabel("Enter a string or regular expression" & @CRLF & "(space between words means ""OR"")", $iX + 50, $iY, 250, 30) $hgSch = GUICtrlCreateInput("", $iX + 50, $iY + 40, 325, 20, $GUI_SS_DEFAULT_INPUT, -1) $hgXyZ = GUICtrlCreateCheckbox("cAsE-sEnSiTiVe", $iX + 50, $iY + 65, -1, -1) $hgExe = GUICtrlCreateButton("Search", 400, $iY + 40, -1, -1) $hgFL1 = GUICtrlCreateLabel("Filespec", $iX + 50, $iY + 100, 250, 20) $hgFs1 = GUICtrlCreateInput("d:\path\*.txt", $iX + 110, $iY + 100, 250, 20, $GUI_SS_DEFAULT_INPUT, -1) $hgFL2 = GUICtrlCreateLabel("Filespec", $iX + 50, $iY + 120, 250, 20) $hgFs2 = GUICtrlCreateInput("", $iX + 110, $iY + 120, 250, 20, $GUI_SS_DEFAULT_INPUT, -1) $hgFL3 = GUICtrlCreateLabel("Filespec", $iX + 50, $iY + 140, 250, 20) $hgFs3 = GUICtrlCreateInput("", $iX + 110, $iY + 140, 250, 20, $GUI_SS_DEFAULT_INPUT,-1) $hgOut = GUICtrlCreateEdit($sOut, 25, 190, 550, 400, $ES_LEFT, -1) GUICtrlSetState($hgSch, $GUI_FOCUS) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; #cs _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgSch)) _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgFs1)) _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgFs2)) _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgFs3)) #ce Thanks in advance.
×
×
  • Create New...