Question > lock the position of window? possible? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
noobgraphicartist
Posts: 59
Joined: 12 Jan 2015, 18:36

Question > lock the position of window? possible?

26 Nov 2016, 07:45

when i use this script
the application will be place automatically at right corner and cannot be resize.

Code: Select all

#Persistent
SetTimer, move_position, 0

move_position:
IfWinNotExist, ahk_class QWidget
return

SetTimer, move_position, Off
WinGetPos,,, Width, Height, ahk_class QWidget
Xpos := (1450)
Ypos := (A_ScreenHeight/2-Height/2)
WinMove, ahk_class QWidget,, %Xpos%, %Ypos%

WinSet, AlwaysOnTop, On, ahk_class QWidget
WinSet, Style, -0x40000, ahk_class QWidget

WinWaitClose, ahk_class QWidget
SetTimer, move_position, On
return

i want to add lock position so it will not be accidently move
is there a way or possible through ahk?

thank you !
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: how to prevent window dragging or lock the position of window?

26 Nov 2016, 08:40

First, a suggestion:

Code: Select all

#Persistent
SetTimer, move_position, -1
return
move_position:
	WinWait, ahk_class QWidget
	WinGetPos,,, Width, Height, ahk_class QWidget
	Xpos := (1450)
	Ypos := (A_ScreenHeight/2-Height/2)
	WinMove, ahk_class QWidget,, %Xpos%, %Ypos%

	WinSet, AlwaysOnTop, On, ahk_class QWidget
	WinSet, Style, -0x40000, ahk_class QWidget
	WinWaitClose, ahk_class QWidget
	SetTimer, move_position, -1
return
Finally, you can disable the caption of the window, WinSet, Style, -0xC00000, ahk_class QWidget
I'd be surprised if there isn't a better solution :)
noobgraphicartist
Posts: 59
Joined: 12 Jan 2015, 18:36

Re: how to prevent window dragging or lock the position of window?

26 Nov 2016, 11:55

Helgef wrote:First, a suggestion:

Code: Select all

#Persistent
SetTimer, move_position, -1
return
move_position:
	WinWait, ahk_class QWidget
	WinGetPos,,, Width, Height, ahk_class QWidget
	Xpos := (1450)
	Ypos := (A_ScreenHeight/2-Height/2)
	WinMove, ahk_class QWidget,, %Xpos%, %Ypos%

	WinSet, AlwaysOnTop, On, ahk_class QWidget
	WinSet, Style, -0x40000, ahk_class QWidget
	WinWaitClose, ahk_class QWidget
	SetTimer, move_position, -1
return
Finally, you can disable the caption of the window, WinSet, Style, -0xC00000, ahk_class QWidget
I'd be surprised if there isn't a better solution :)
thanks it resolve lock position of window
but i have problem now if i use that script

Image

the window is now resizable and not lock
any other solution or workaround ?

thanks
GEV
Posts: 1002
Joined: 25 Feb 2014, 00:50

Re: Question > lock the position of window? possible?  Topic is solved

26 Nov 2016, 12:38

Try removing the line

Code: Select all

WinWaitClose, ahk_class QWidget
noobgraphicartist
Posts: 59
Joined: 12 Jan 2015, 18:36

Re: Question > lock the position of window? possible?

26 Nov 2016, 12:48

GEV wrote:Try removing the line

Code: Select all

WinWaitClose, ahk_class QWidget
thanks it solve the problem !

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Giresharu and 263 guests