Jump to content

Sticky UI


 Share

Recommended Posts

This should get you started, it snaps window to the screens edges :)

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUiOnEventMode", 1)
GUICreate("test", 300, 300)
GUISetState()
GUISetOnEvent(-3, "close")
GUIRegisterMsg($WM_MOVE, "moved")
While 1
    Sleep(100)
WEnd

Func close()
    Exit
EndFunc   ;==>close

Func moved()
    $pos = WinGetPos("test")
    If $pos[0] < 25 Then WinMove("test", "", 0, $pos[1])
    If $pos[1] < 25 Then WinMove("test", "", $pos[0], 0)
    If $pos[0] + 300 > @DesktopWidth - 25 Then WinMove("test", "", @DesktopWidth - 300, $pos[1])
    If $pos[1] + 300 > @DesktopHeight - 25 Then WinMove("test", "", $pos[0], @DesktopHeight - 300)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>moved

Good Luck! :(

Broken link? PM me and I'll send you the file!

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