How to make GUI movable (buttons covers the title bar)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

How to make GUI movable (buttons covers the title bar)

17 Apr 2018, 02:46

Code:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Menu, tray, Icon , face1.ico, 1, 1
Gui, New, +AlwaysOnTop, 

;Gui, Add, Picture, x2 y-1 w70 h70 +BackgroundTrans, C:\Users\\Desktop\as\New folder\emoji tool\general\Border-68-A4--Arvin61r58.png
;Gui, Add, Picture, x72 y-1 w70 h70 +BackgroundTrans, C:\Users\\Desktop\as\New folder\emoji tool\general\Border-68-A4--Arvin61r58.png
Gui, Add, Picture, x2 y-1 w70 h70 +BackgroundTrans, C:\Users\\Desktop\as\New folder\emoji tool\Smileys\face-positive\face1.png
Gui, Add, Picture, x72 y-1 w40 h70 +BackgroundTrans, C:\Users\\Desktop\as\New folder\emoji tool\general\cooltext283191731048165.png
Gui, Add, Picture, x82 y-1 w40 h70 +BackgroundTrans, C:\Users\\Desktop\as\New folder\emoji tool\general\cooltext283191742318754.png
Gui, Add, Picture, x102 y-1 w40 h70 +BackgroundTrans, C:\Users\\Desktop\as\New folder\emoji tool\general\cooltext283191749514729.png
Gui, Add, Picture, x2 y69 w70 h30 , C:\Users\\Desktop\as\New folder\emoji tool\general\cooltext283191636545992.png
Gui, Add, Picture, x72 y69 w50 h30 , C:\Users\\Desktop\as\New folder\emoji tool\general\cooltext283191684825069.png
Gui, Add, Picture, x22 y99 w100 h50 +BackgroundTrans, C:\Users\\Desktop\as\New folder\emoji tool\general\cooltext283191884884057.png
Gui, Add, Picture, x2 y149 w140 h30 , C:\Users\\Desktop\as\New folder\emoji tool\general\cooltext283192787526476.png
Gui, Add, Picture, x42 y179 w60 h40 , C:\Users\\Desktop\as\New folder\Yes.png
; Generated using SmartGUI Creator 4.0
Gui, Show, x478 y186 h220 w147, New GUI Window
;gui, destroy 
;Gui, Show, x478 y186 h220 w147, New GUI Window

Return

GuiClose:
ExitApp
Preview:
marry.png
marry.png (27.58 KiB) Viewed 1740 times
As you can see, the X, [] and - buttons completely dominate the titlebar. This makes it so that the GUI is immovable.

I want to move the GUI though.

So how do I make it so that either
1) [] (maximize button) does not exist.
2) Clicking and dragging the GUI will move it.
3) Clicking and dragging the titlebar will move it.

I don't know if all three are possible but if they are, then it's great! Thanks a lot! :D
I am your average ahk newbie. Just.. a tat more cute. ;)
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: How to make GUI movable (buttons covers the title bar)

17 Apr 2018, 04:51

gamergames wrote:try

gui -MinimizeBox
Hey buy,

I really appreciate it! I didn't realize that it would entirely remove the buttons. But is there anyway to also have a minimize button in the titlebar but just not the maximize? Or even remove the title icon entirely? Or I have to include those inside the GUI itself?

One con is that I cannot move the GUi without a titlebar. I would have to use a timer with mousegetpos which I want to avoid. And then I need to make custome images. So I want to avoid removing the titlebar entirely.

Cheers! :D
I am your average ahk newbie. Just.. a tat more cute. ;)
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: How to make GUI movable (buttons covers the title bar)

17 Apr 2018, 06:49

You can move any gui by left-click and drag with this:

Code: Select all

OnMessage(0x0201, "WM_LBUTTONDOWN")
gui,show, w200 h200
return

WM_LBUTTONDOWN() {
   If (A_Gui)
      PostMessage, 0xA1, 2
}

____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
xlorate
Posts: 9
Joined: 24 Dec 2022, 06:35

Re: How to make GUI movable (buttons covers the title bar)

19 Mar 2023, 08:29

I know this is old, I have a GUI:2 on top of GUI:1
I have

Code: Select all

PostMessage, 0xA1, 2,,, A
for GUI:1 but it leaves Gui:2 behind
Is there a way to inclde Gui:2 with that line of code?
;)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: gongnl, jaka1, mikeyww and 313 guests