Jump to content

how to lock a window?


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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