Sign in to follow this  
Followers 0
blackey

Fixed gui question

4 posts in this topic

#1 ·  Posted (edited)

Is there a way using koda to create a gui and make it not movable, but keep it fixed at the specified coordinates?

Edited by blackey

Share this post


Link to post
Share on other sites



Is there a way using koda to create a gui and make it not movable, but keep it fixed at the specified coordinates?

Didn't use Koda, but here's a method from scratch you can try:

#include <GUIConstants.au3>

$iWidth=500
$iHeight=450
$iXPos = Int(@DesktopWidth/2-$iWidth/2)
$iYPos = Int(@DesktopHeight/2-$iHeight/2)
GUICreate("ImmobileGUI",$iWidth,$iHeight,$iXPos,$iYPos)
GUISetState (@SW_SHOW)

$location=WinGetPos("ImmobileGUI")

While 1
    $newlocation=WinGetPos("ImmobileGUI")
    If $newlocation[0] <> $location[0] Or $newlocation[1] <> $location[1] Then
        WinMove("ImmobileGUI","",$iXPos,$iYPos)
    EndIf
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Tested with a mild flicker when attempting to move the window, but it essentially "locks" the window position.


- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Another method, no title bar or min, max or exit buttons

use gui buttons or hotkeys to control

; ESC key to exit

#include <Constants.au3>
#include <GUIConstants.au3>

HotKeySet("{ESC}", "ExitNow")           ; ESC   - Exit Program

$WINDOWWIDTH = 500
$WINDOWHEIGHT = 100
$WINDOWLOCATIONX = (@DesktopWidth - $WINDOWWIDTH) / 2
$WINDOWLOCATIONY = (@DesktopHeight - $WINDOWHEIGHT) / 2

GUICreate("Imovable GUI Example", $WINDOWWIDTH, $WINDOWHEIGHT, $WINDOWLOCATIONX, $WINDOWLOCATIONY, BitOr($WS_POPUP,$WS_DLGFRAME),$WS_EX_TOOLWINDOW)
GUICtrlCreateLabel("Imovable GUI Example - Press ESC To Exit", 10, 10, 250,16, $SS_LEFTNOWORDWRAP)
GUICtrlSetFont(-1, 9, 4, '', 'ARIAL BOLD')
GUICtrlSetColor(-1, 0x000000)
GUISetState()

While 1
    
WEnd

Func ExitNow()
    GUIDelete()
    Exit
EndFunc

I see fascists...

Share this post


Link to post
Share on other sites

Thank you guys this is perfect!

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  
Followers 0