Sign in to follow this  
Followers 0
BALA

Change a GUI's title

15 posts in this topic

I've tried searching for this but I suppose I was to vague in describing it because I kept on getting threads about WinSetTitle and GUICtrlSetData. What I need to know is how to reset the title of a GUI that I've already created.


[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites



I've tried searching for this but I suppose I was to vague in describing it because I kept on getting threads about WinSetTitle and GUICtrlSetData. What I need to know is how to reset the title of a GUI that I've already created.

WinSetTitle()

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

WinSetTitle()

Oh, I can't believe it was the command I've been avoiding. Well thanks then

Edited by BALA

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites

Your own GUI can be dealt with as a normal window.... So every command you can use on a normal window is also possible on a GUI you created :)


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Oh, I can't believe it was the command I've been avoiding. Well thanks then

Don't know why you've been avoiding it, but if you have to customize it so you feel like you are using it app specific, I suppose you could :)
$MainGUI = GUICreate('Some Random Title', 200, 80)
$Input = GUICtrlCreateInput('', 10, 10, 180, 20)
$Button = GUICtrlCreateButton('Change', 10, 40, 180, 25)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $Button
            _GUISetTitle(GUICtrlRead($Input))
    EndSwitch
WEnd

Func _GUISetTitle($sTitle, $hWnd = '')
    $hWnd = _GetHWnd($hWnd)
    Return WinSetTitle($hWnd, '', $sTitle)
EndFunc

Func _GetHWnd($hWnd)
    If $hWnd = '' Then
        $hWnd = WinGetHandle('')
    ElseIf IsString($hWnd) And WinExists($hWnd) Then
            $hWnd = WinGetHandle($hWnd)
    ElseIf StringInStr($hWnd, '0x') And IsHWnd($hWnd) = 0 Then
        $hWnd = HWnd($hWnd)
    EndIf
    Return $hWnd
EndFunc

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

SmOke_N : Why all the extra-stuff ? :)

$gui = GUICreate("")
GUISetState()
Sleep(2000)

WinSetTitle($gui, "", "newTitle")
Sleep(2000)
Did you read my comment? If he felt the need to make it more GUI specific :D.

Edit:

On the plus side of that... if you need to pass a child handle that isn't active, you can do that as well. But yes, the need for the UDFs are primarily useless IMO, it was in jest that I did them (thus the laughing face in my comment).

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

It wasn't exactly avoiding, it's just it caused an error when I tried using it the first time so I thought I was using the wrong command. Anyways I found the real problem (a typo in the variable name :) ) that was causing the error so it's fine now. Anyways, thanks for the helpful responds.

Edited by BALA

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites

Did you read my comment? If he felt the need to make it more GUI specific :D.

Sure. I read it alright... I think it's a matter of not understand it instead. I even tilted my head at one point :D

Nevermind... You're not the only one who's been lacking a good night sleep lately :)

Share this post


Link to post
Share on other sites

Sleep(100)


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Sleep(100)

Um... what does that have to do with changing the title of a window :) ?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

You're not the only one who's been lacking a good night sleep lately

:) Gave him a helping hand


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

:D Gave him a helping hand

I get it :)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites
:)

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

It wasn't exactly avoiding, it's just it caused an error when I tried using it the first time so I thought I was using the wrong command. Anyways I found the real problem (a typo in the variable name :) ) that was causing the error so it's fine now. Anyways, thanks for the helpful responds.

Bala,

You can also use a DllCall

DllCall("user32.dll", "int", "SetWindowText", "hwnd", $hInst, "str", "Changed the Window Title")

Regards

Dougie

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