Sign in to follow this  
Followers 0
JScript

_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 ...

Code:

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
    EndIf
    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,

JS

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

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

    • KimberlyJillPereira
      By KimberlyJillPereira
      I am a newbie in AutoIt. May I know what is the code used to expand the width and height of excel cells because I want to insert pictures in the cell.I tried AutoFit but that doesnt work as I cant specify for the width and height. Only for column width I could expand by using .ColumnWidth but for the row I am not able to expand the row? How to do?? What is the code used ??Please help me and thank you.
    • KimberlyJillPereira
      By KimberlyJillPereira
      I am a newbie in AutoIt. May I know what is the code used to expand the width and height of excel cells because I want to insert pictures in the cell.I tried AutoFit but that doesnt work as I cant specify for the width and height. Only for column width I could expand by using .ColumnWidth but for the row I am not able to expand the row? How to do?? What is the code used ??Please help me and thank you.
    • 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 ever...you 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?