Sign in to follow this  
Followers 0
BoogY

Centered GUI on open

5 posts in this topic

Hi there ...

How can i put a GUI windows in the midle of the screen on launch of the script ?

Thanks a lot :D

Share this post


Link to post
Share on other sites



In the help file read about the paramaters for GUICreate especially the ones for top and left.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Hi,

How about this.

#include <GUIConstantsEx.au3>

$width = 100 ; Width of the GUI
$height = 100 ; Height of the GUI


GUICreate("MY GUI", $width, $height, (@DesktopWidth / 2) - ($width / 2), (@DesktopHeight / 2) - ($height / 2))

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()

Exit

The GUI will surely centered in any screen resolution.

It calculate the centering of the GUI on screen by getting the Desktop width and height.


[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]

Share this post


Link to post
Share on other sites

In the help file read about the paramaters for GUICreate especially the ones for top and left.

Thanks a lot it works :D

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