Jump to content
Sign in to follow this  
x0xar33wx0x

How do I fit my gui to the users screen

Recommended Posts

x0xar33wx0x

How can I make it so it will fit my gui to the users screen resolution when they launch my program?

Share this post


Link to post
Share on other sites
toothyXdip

you mean

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

#include <GuiConstants.au3>

GuiCreate("MyGUI", @DesktopWidth, @DesktopHeight-60, -1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
Edited by toothyXdip

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝

Share this post


Link to post
Share on other sites
x0xar33wx0x

that doesn't work

Share this post


Link to post
Share on other sites
toothyXdip

works for me

why what errors are you getting/what is going wrong?

Edited by toothyXdip

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝

Share this post


Link to post
Share on other sites
therks

that doesn't work

Sure it does, you just have to do it different (we can be vague too).

Share this post


Link to post
Share on other sites
Achilles

The key line of code in toothyXdip was the GuiCreate. The @DesktkopHeight and @DesktopWidth return the height and width of desktop screen. So if you do GuiCreate('Testing', @DesktopHeight, @DesktopWidth), it will create a GUI that is as big as your screen.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Vindicator209

Plus the -60 so it doesn't cover the taskbar.

You'll have to tell us what isin't working, or what errors your getting, "it doesnt work" doesn't help.

Cheers


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
Achilles

Plus the -60 so it doesn't cover the taskbar.

You'll have to tell us what isin't working, or what errors your getting, "it doesnt work" doesn't help.

Cheers

However, just subtracting 60 from the height doesn't always work due to varying sizes/positions of the taskbar. You can use WinGetPos to do it. I don't have time to conjure an example but somebody else might.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
BrettF

This works well:

;===============================================================================
;
; Function Name:    _GetWorkingArea()
; Description:    Returns the coordinates of desktop working area rectangle
; Parameter(s):  None
; Return Value(s):  On Success - Array containing coordinates:
;                       $a[0] = left
;                       $a[1] = top
;                       $a[2] = right
;                       $a[3] = bottom
;                  On Failure - 0
;
;===============================================================================
Func _GetWorkingArea()
    #cs
        BOOL WINAPI SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
        uiAction SPI_GETWORKAREA = 48
    #ce
    Local $dRECT = DllStructCreate("long; long; long; long")
    Local $spiRet = DllCall("User32.dll", "int", "SystemParametersInfo", _
            "uint", 48, "uint", 0, "ptr", DllStructGetPtr($dRECT), "uint", 0)
    If @error Then Return 0
    If $spiRet[0] = 0 Then Return 0
    Local $aRet[4] = [DllStructGetData($dRECT, 1), DllStructGetData($dRECT, 2), DllStructGetData($dRECT, 3), DllStructGetData($dRECT, 4) ]
    Return $aRet
EndFunc  ;==>_GetWorkingArea

Share this post


Link to post
Share on other sites
NomadRJ

Nice tip Bert!

I was working fine with DesktopWidth & @DesktopHeight, but in this case you don't know the height of the taskbar set by user. Your function does a better job. Thanks!

[ ]s

Share this post


Link to post
Share on other sites
Danny35d

Tri it:

#include <GUIConstants.au3>

Opt("WinTitleMatchMode", 4)

$Pos = WinGetPos("classname=Shell_TrayWnd")
If $Pos[2] <> @DesktopWidth Then $Pos[2] = @DesktopWidth - $Pos[2]
If $Pos[3] <> @DesktopHeight Then 
    $Pos[3] = @DesktopHeight - ($Pos[3] + 32)
Else
    $Pos[3] -= 32
EndIf

$Form1 = GUICreate("AForm1", $Pos[2], $Pos[3], -1, -1)
GUISetBkColor (0xE0FFFF)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

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  

×