Jump to content

[SOLVED]Gui in corner of screen no matter what pc i am on?


 Share

Recommended Posts

Alloha,

I was wondering how to do this the code i have that i want in the right corner is:

$GMenu = GUICreate("Menu", 166, 347, 1735, 810, $WS_POPUP)
$BClose = GUICtrlCreateButton("Close", 48, 320, 75, 25)
GUICtrlSetOnEvent($BClose, "Close")
$B1 = GUICtrlCreateButton("Programs", 48, 0, 75, 25)
GUICtrlSetOnEvent($B1, "Programs")
$B2 = GUICtrlCreateButton("Credits", 48, 24, 75, 25)
GUICtrlSetOnEvent($B2, "Credits")
$B3 = GUICtrlCreateButton("Scripts", 48, 48, 75, 25)
GUICtrlSetOnEvent($B3, "Scripts")
$B4 = GUICtrlCreateButton("Private", 48, 72, 75, 25)
GUICtrlSetOnEvent($B4, "Private")
$B5 = GUICtrlCreateButton("Admin", 48, 96, 75, 25)
GUICtrlSetOnEvent($B5, "Admin")
$B6 = GUICtrlCreateButton("B6", 48, 120, 75, 25)
GUICtrlSetOnEvent($B6, "")
$B7 = GUICtrlCreateButton("B7", 48, 144, 75, 25)
GUICtrlSetOnEvent($B7, "")
$B8 = GUICtrlCreateButton("B8", 48, 168, 75, 25)
GUICtrlSetOnEvent($B8, "")
$B9 = GUICtrlCreateButton("B9", 48, 192, 75, 25)
GUICtrlSetOnEvent($B9, "")
$B10 = GUICtrlCreateButton("B10", 48, 216, 75, 25)
GUICtrlSetOnEvent($B10, "")
$B11 = GUICtrlCreateButton("B11", 48, 240, 75, 25)
GUICtrlSetOnEvent($B11, "")
$B12 = GUICtrlCreateButton("B12", 48, 264, 75, 25)
GUICtrlSetOnEvent($B12, "")
GUISetState()

is this possible to do?

and ifso how:O ugh i feel so newb right now :')

Edited by satanttin
Link to comment
Share on other sites

You're doing it wrong, you use those macros to determine how big the screen is, not how big you GUI is. Once you know how big the screen resolution is, with a little math you can figure out where to place the GUI.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Try this:

#include <WindowsConstants.au3>


$GUI_width = 166
$GUI_height = 347
$aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", "")

$iPos = 1
Switch $iPos
    Case 0 ;left upper
        $iX = 0
        $iY = 0
    Case 1 ;right upper
        $iX = @DesktopWidth - $GUI_width
        $iY = 0
    Case 2 ;left buttom
        $iX = 0
        $iY = @DesktopHeight - $aTaskbar[3] - $GUI_height
    Case 3 ;right buttom
        $iX = @DesktopWidth - $GUI_width
        $iY = @DesktopHeight - $aTaskbar[3] - $GUI_height
EndSwitch
$GMenu = GUICreate("Menu", $GUI_width, $GUI_height, $iX, $iY, $WS_POPUP)
GUISetBkColor(0xABCDE)
GUISetState()

Do
    If GUIGetMsg() = -3 Then Exit
Until False

Br,

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

Try this:

#include <WindowsConstants.au3>


$GUI_width = 166
$GUI_height = 347
$aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", "")

$iPos = 1
Switch $iPos
    Case 0 ;left upper
        $iX = 0
        $iY = 0
    Case 1 ;right upper
        $iX = @DesktopWidth - $GUI_width
        $iY = 0
    Case 2 ;left buttom
        $iX = 0
        $iY = @DesktopHeight - $aTaskbar[3] - $GUI_height
    Case 3 ;right buttom
        $iX = @DesktopWidth - $GUI_width
        $iY = @DesktopHeight - $aTaskbar[3] - $GUI_height
EndSwitch
$GMenu = GUICreate("Menu", $GUI_width, $GUI_height, $iX, $iY, $WS_POPUP)
GUISetBkColor(0xABCDE)
GUISetState()

Do
    If GUIGetMsg() = -3 Then Exit
Until False

Br,

UEZ

i will take a look into that^^
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...