Jump to content

Recommended Posts

Posted

Hi!

I'm trying to remove these buttons from the Autoit GUI Form: minimize, restore down, maximize and close. The three buttons we usually see from the top right hand corner of every window.

and

Is there a way that I can put the Title at the center because it usually appears at the top left hand side?

Is it possible to do this with Autoit Koda? Or is there another way?

I've tried searching for this in the forums and Koda but cannot find one.

Thank You.

Posted

Look at GUICreate() & $WS_POPUP in the Help file.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Maybe this will help?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

And thanks for the tip Guinness,

But Is there a way that I can put the Title text at the center of the GUI because it usually appears at the top left hand side?

Posted (edited)

Try this.

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

Local $iGuiWidth = 500 ; initial width of window
Local $sTitle = "Window Title" ; caption for window

;$hGui = GUICreate($sTitle, $iGuiWidth, 400, -1, -1, BitxOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) ; Exit box & Centre title
Local $hGui = GUICreate($sTitle, $iGuiWidth, 400, -1, -1, $WS_CAPTION) ; Centre title only (Press Esc to exit)

GUISetState(@SW_SHOW); will display an empty dialog box
SetCentreTitle($hGui, $sTitle)

While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
;GUIDelete()

Func SetCentreTitle($hWnd, $sTitle)
    Local $aWPos = WinGetPos($hWnd)
    $hDC = _WinAPI_GetDC($hWnd)
    Do
        $sTitle = ' ' & $sTitle & " "
        $tSize = _WinAPI_GetTextExtentPoint32($hDC, $sTitle)
        WinSetTitle($hWnd, "", $sTitle)
        ;sleep(50)
        ; Until DllStructGetData($tSize, 1) > $aWPos[2]*2 ; 1.2  ; Title on right
    Until DllStructGetData($tSize, 1) > $aWPos[2] * 1.2 ; Title at centre
EndFunc   ;==>SetCentreTitle

Edit: Added <GUIConstantsEx.au3>, <WinAPI.au3>, and <WindowsConstants.au3> behind the three blank #includes, as mentioned in the next 2 posts.

Edited by Malkey
Posted

Hi Malkey,

Please about the #include,

I only know this one " #include <WindowsConstants.au3> " and this " #include <GUIConstantsEx.au3> " but the other one "#include" I don't know that is why it is giving me errors.

Please show me

Thank You

Posted (edited)

Use this...

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
A quick search of the help file and using the errors returned would've saved you time posting that message, Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

WOW! Thank you very much guinness,

I'll try my best to find my way through the help files

And thanks all for the help

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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