Jump to content

Setting a GUI window to a screen's corner


 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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?

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...