3mustgetbeers Posted April 23, 2011 Share Posted April 23, 2011 Hi guys. I want to create a small GUI that shows in the bottom right of the screen, just above the systems tray. The following code does this on my laptop: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $GUI = GUICreate("Test", 259, 83, 1006, 640) $Text = GUICtrlCreateLabel("Test", 88, 24, 58, 36) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd When this is run on a different resolution the GUI is out of place - obviously due to specifying the position the GUI is set to appear. Anybody know what I need to do to get this to appear in the correct place no matter of the resolution? I guess I need to specify where to place the gui in relation to the res, but not sure from there Thanks in advance, 3mgb Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 23, 2011 Moderators Share Posted April 23, 2011 3mustgetbeers,Use the @DesktopWidth and @DesktopHeight macros to determine the resolution - then position your GUI relative to those values: $GUI = GUICreate("Test", 259, 83, @DesktopWidth - 260, @DesktopHeight - 105)Of course, you will need to adjust the values to get it exactly where you want. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
UEZ Posted April 23, 2011 Share Posted April 23, 2011 (edited) Try this: #include <Array.au3> #include <GUIConstantsEx.au3> $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd]", "") $GUI = GUICreate("Test", 259, 83, @DesktopWidth, @DesktopHeight) $Text = GUICtrlCreateLabel("Test", 88, 24, 58, 36) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $aWin = WinGetPos($GUI) WinMove($GUI, "", @DesktopWidth - $aWin[2] - 4, @DesktopHeight - $aWin[3] - $aTaskbar[3] - 4) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Tested on Win7 x64. Br, UEZ Edited April 28, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
3mustgetbeers Posted April 23, 2011 Author Share Posted April 23, 2011 Thats great! Cheers guys UEZ; See the $aWin[2] part, what does the 2 mean?? cheers! Link to comment Share on other sites More sharing options...
UEZ Posted April 23, 2011 Share Posted April 23, 2011 (edited) Just look in the help file: http://www.autoitscript.com/autoit3/docs/functions/WinGetPos.htm It is the width of the window. I tried to calculate the height of the taskbar, width and height of the windows and finally a little calculation to place the window to the right bottom just above the taskbar. Br, UEZ PS: I update the code. Edited April 23, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
3mustgetbeers Posted April 23, 2011 Author Share Posted April 23, 2011 nice one Thought it was going to be a lot harder than that, cheers UEZ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now