Sign in to follow this  
Followers 0

_GUICreateEx - Width and Height relative to GUI

1 post in this topic

#1 ·  Posted (edited)

Hello guys ...

I noticed that a window created with AutoIt, the coordinates of width and height are relative to the client area rather than to the window itself!

Well, after some tests I got this simple code that causes the width and height are for the window and not to the client area.

I hope it's useful for someone else ...


Func _GUICreateEx($Title, $iWidth = 400, $iHeight = 400, $iLeft = -1, $iTop = -1, $iStyle = -1, $iexStyle = -1, $hParent = 0)
    If $iWidth > @DesktopWidth Then
        $iFrameY = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 33)
        $iFrameY = $iFrameY[0]
        $iWidth = @DesktopWidth - $iFrameY
    If $iHeight > @DesktopHeight Then $iHeight = @DesktopHeight

    Local $hWnd = GUICreate($Title, $iWidth, $iHeight, $iLeft, $iTop, $iStyle, $iexStyle, $hParent)
    WinMove($hWnd, "", Int((@DesktopWidth - $iWidth) / 2), Int((@DesktopHeight - $iHeight) / 2), $iWidth, $iHeight)

    Return $hWnd
EndFunc   ;==>_GUICreateEx
The syntax, of course, is the same as the native function!

So long,


Edited by JScript (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram


dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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

  • Similar Content

    • Jewtus
      By Jewtus
      I am using the following code to create a Gui and a progress bar that I can minimize:
      Global $Home = GUICreate("Intake", 1366,768, 192, 114, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX)) ProgressOn("Processing...", "Backing up", "Please wait...", 0, 0, $DLG_MOVEABLE + $DLG_NOTONTOP)  
      This works, but the part that I'm trying to fix is that there is a GUI where you press the button to kick off the progress and I'm wondering if there is a way to nest the progress bar into that gui so its movable, but when I minimize the GUI, the progress window also minimized (same for if its clicked... pull both the GUI and progress window up together). Right now, I get the Gui window and no Progress window on the task bar, but when I alt+Tab i can see both. This makes it so sometimes the progress bar is pushed to the background and the GUI sits on top preventing you from seeing the progress window.
      Any easy way of doing this?
    • Muzaiyan
      By Muzaiyan
      Hi all
      this is an Photoshop edited image but i want to create a window like that
      it should have an extra button for specific tasks.
      Can anyone give me a clue to create a GUI like that

    • nitekram
      By nitekram
      NO code, but a question...what is your method for adding a control in an already created GUI.

      Say you created your GUI, and then decided that there was something missing, and you wanted to put it in the middle or where have to move all the controls after it and it is a pain.

      Does anyone have an easy method, or the method you choose to begin with so you do not have to worry about this coming up in the future?
    • timmy2
      By timmy2
      post deleted due to no responses and subsequent findings re bmp file rendering
    • xeroTechnologiesLLC
      By xeroTechnologiesLLC
      Greetings programmers,

      Back with another, probably dumb, question.

      I created a menu bar that lets users dynamically add and remove items - fun times (with more help than listable from one particular BA$$ on this forum - thank you again); and now that they can remove the items I need the bar to resize to fit shorter or longer against what items are left.

      starts off with a dozen menu items
      user removes 5
      restarts the program
      i need the bar to read the width of the left over menu items and make the gui that + about 5 to 10 pixels for safety.


      I tried the getcntrlpos but it doesn't work for menu items.

      Any thoughts, ideas / directions?

      Thanks in advance.