How can I get the width and height of a GUI window in AHK?

14 Views Asked by At

I'm trying to make a GUI window with an Edit control inside that will automatically resize to fit the GUI. How can I get the current dimensions of the GUI window?

Here's my code:

#Requires AutoHotkey 2.0

ResizeWindow(*) {
    EditBox.Opt("w" TextBoxGUI.Width " h" TextBoxGUI.Height) ; Here's the issue
}

TextBoxGUI := Gui("+Resize", "TextBox GUI")
    TextBoxGUI.OnEvent("Size", ResizeWindow)
TextBoxGUI.SetFont("s15 Norm", "Lexend")
EditBox := TextBoxGUI.Add("Edit", "x0 y0 w500 h600")

TextBoxGUI.Show("w500 h600")
0

There are 0 best solutions below