Jump to content
Sign in to follow this  
taurus905

AutoIt Gui with button on titlebar

Recommended Posts

taurus905

I know I have seen an example in the past of a button on the titlebar of an AutoIt Gui, but I am not having any luck searching the forum.

I would appreciate if someone could either point me in the right direction, or post a simple exmaple of how to create an AutoIt Gui with a button on the titlebar.

Thank you in advance for any help in this matter.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites
Nahuel

Well, I don't know if there's an "advanced" mode of doing this, but I guess you could create a GUI with no title bar and "recreate" the titlebar with standard controls. Here's an example:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 450, 259, 309, 256,$WS_POPUP)
$Label1 = GUICtrlCreateLabel("This could be the titlebar of my GUI", 0, 0, 387, 17)
GUICtrlSetBkColor(-1, 0x808080)
$totray = GUICtrlCreateButton(".", 390, 1, 19, 19, 0)
GUICtrlSetFont(-1, 15, 800, 0, "MS Sans Serif")
$minimize = GUICtrlCreateButton("_", 410, 1, 19, 19, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$close = GUICtrlCreateButton("X", 430, 1, 19, 19, 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $close
            Exit
        Case $totray
            MsgBox(0,"","Now minimizing to tray",Default,$Form1)
        Case $minimize
            GUISetState(@SW_MINIMIZE)
        Case $Label1
            _Drag($Form1);This UDF (gafrost) is to drag the GUI exactly as if it was being dragged from the titlebar
    EndSwitch
WEnd

Func _Drag($h_gui)
   DllCall("user32.dll", "int", "ReleaseCapture")
   DllCall("user32.dll", "int", "SendMessage", "hWnd", $h_gui, "int", 0xA1, "int", 2, "int", 0)
EndFunc;==>_Drag

Also, you have to check out Valuater's XSkin: http://www.autoitscript.com/forum/index.php?showtopic=32494

It can do all those cool things.

Edited by Nahuel

Share this post


Link to post
Share on other sites
taurus905

Hello Nahuel,

Thank you for the example.

The gui I want to create is a child gui similar to the one below.

I want the two buttons to be moved up from their current position so they would appear on the titlebar.

This may be something I've seen Holger or GaryFrost do in the past.

taurus905

post-8446-1220310081_thumb.png


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites
taurus905

You could see if this has the source included in the download (if not maybe PM the maker):

http://www.autoitscript.com/forum/index.php?showtopic=71198

Hello LongBowNZ,

Thank you for the link to an excellent script.

It appears my solution may be to create a popup window which is the same size as the button I want to place on the titlebar.

But if anyone else knows of another way to place a button on a gui titlebar, I will be open to your suggestion.

Thank you for your help.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

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  

×