Jump to content
Sign in to follow this  
erezlevi

how to lock a window?

Recommended Posts

erezlevi

how can I lock a window so the user can't move it or close it?

Share this post


Link to post
Share on other sites
flip209

Look at WinSetState


" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites
erezlevi

Look at WinSetState

hi,

you can't lock a window with it only hiding it.

Share this post


Link to post
Share on other sites
flip209

winsetstate(Title,Text,@SW_DISABLE)

Try that

Edited by flip209

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Share this post


Link to post
Share on other sites
erezlevi

winsetstate(Title,Text,@SW_DISABLE)

Try that

it does not lock the window in the screen it locks it from tuching it.

Share this post


Link to post
Share on other sites
FreeFry

If the gui is owned by autoit, you can do this to lock it in place:

#include <WinAPI.au3>
#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 633, 447, 193, 125)

Dim $origWindowPos = WinGetPos($Form1)

GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WM_WINDOWPOSCHANGING")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _WM_WINDOWPOSCHANGING($hWndGUI, $MsgID, $WParam, $LParam)
    
    Local $wPosStruct = DllStructCreate("hwnd hwnd;hwnd InsertAfter;int x;int y;int cx;int cy;uint flags", $LParam)
    
    DllStructSetData($wPosStruct, "x", $origWindowPos[0])
    DllStructSetData($wPosStruct, "y", $origWindowPos[1])
    DllStructSetData($wPosStruct, "cx", $origWindowPos[2])
    DllStructSetData($wPosStruct, "cy", $origWindowPos[3])
    
EndFunc

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  

×