Jump to content
Sign in to follow this  
Stalker0

Setting a GUI window to a screen's corner

Recommended Posts

Stalker0

I'm creating a GUI window that I want to appear in the bottom right corner of the screen. Thing is, the window will appear on multiple computers, each with a different sized screen. Is there are way to softcode the window to always appear in the bottom right corner relative to the size of the window?

Edited by Stalker0

Share this post


Link to post
Share on other sites
Paulie

@DesktopWidth

@DesktopHeight

Give you resolution.

Share this post


Link to post
Share on other sites
Stalker0

@DesktopWidth

@DesktopHeight

Give you resolution.

Thank you for the quick response. What do you mean by "give you resolution". Does the resolution matter if I use those macros?

Share this post


Link to post
Share on other sites
SmOke_N

Thank you for the quick response. What do you mean by "give you resolution". Does the resolution matter if I use those macros?

He's talking about your screen/monitor Width and Height, not your color quality.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
cppman

Global Const $TOPLEFT = 0
Global Const $TOPRIGHT = 1
Global Const $BOTTOMLEFT = 2
Global Const $BOTTOMRIGHT = 3

Func _CornerWindow($hWnd, $Corner)
    Local $WindowInfo
    Local $x, $y
    Local $tx = @DesktopWidth
    Local $ty = @DesktopHeight
    
    $WindowInfo = WinGetPos($hWnd)
    
    if ($Corner == 0) Then
        $x = 0
        $y = 0
    Elseif ($Corner == 1) Then
        $x = $tx - $WindowInfo[2]
        $y = 0
    Elseif ($Corner == 2) Then
        $x = 0
        $y = $ty - $WindowInfo[3]
    Elseif ($Corner == 3) Then
        $x = $tx - $WindowInfo[2]
        $y = $ty - $WindowInfo[3]
    Else
        return 0
    EndIf
    
    WinMove($hWnd, "", $x, $y)
EndFuncoÝ÷ Ù©Ýjw±jjez;¬µª®É(殶­sbb33c·FW7BÒuT7&VFRgV÷CµFW7BgV÷C²¤uT6WE7FFR¤÷D¶W6WBgV÷C·´c'ÒgV÷C²ÂgV÷CµõF÷ÆVgBgV÷C²¤÷D¶W6WBgV÷C·´c7ÒgV÷C²ÂgV÷CµõF÷&vBgV÷C²¤÷D¶W6WBgV÷C·´cGÒgV÷C²ÂgV÷Cµô&÷GFöÔÆVgBgV÷C²¤÷D¶W6WBgV÷C·´cWÒgV÷C²ÂgV÷Cµô&÷GFöÕ&vBgV÷C² §vÆR¥tVæ@ ¤gVæ2õF÷ÆVgB¢ô6÷&æW%væF÷rb33c·FW7BÂb33cµDõÄTeB¤VæDgVæ0 ¤gVæ2õF÷&vB¢ô6÷&æW%væF÷rb33c·FW7BÂb33cµDõ$tB¤VæDgVæ0 ¤gVæ2ô&÷GFöÔÆVgB¢ô6÷&æW%væF÷rb33c·FW7BÂb33c´$õEDôÔÄTeB¤VæDgVæ0 ¤gVæ2ô&÷GFöÕ&vB¢ô6÷&æW%væF÷rb33c·FW7BÂb33c´$õEDôÕ$tB¤VæDgVæ

This what you are trying to do?

Share this post


Link to post
Share on other sites
Stalker0

Thank you all for the help, I've got it working now!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.