shaqan Posted March 28, 2010 Posted March 28, 2010 Hi, found sample like this #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Const $SC_MOVE = 0xF010 $hGUI = GUICreate("Not moved GUI") GUISetState() GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) If BitAND($wParam, 0x0000FFF0) = $SC_MOVE Then Return False Return $GUI_RUNDEFMSG EndFunc How to modify it to lock position (so it cant be dragged with mouse) of some other non-fullscreen program GUI window. Like for example Notepad?
Steveiwonder Posted March 28, 2010 Posted March 28, 2010 (edited) Hello, Try this. $wintitle = "Untitled - Notepad"; $x = 334 ; X $y = 159 ; Y While 1 $pos = WinGetPos($wintitle); If $pos[0] <> $x OR $pos[1] <> $y Then WinMove($wintitle, "", $x, $y); EndIf sleep(10); WEnd If you want to stop it from being minimized, also look at WinGetState() & WinSetState() Steve Edited March 28, 2010 by Steveiwonder They call me MrRegExpMan
shaqan Posted March 28, 2010 Author Posted March 28, 2010 (edited) thank you also looks like I should have made this topic into "GUI help section", sorry Edited March 28, 2010 by shaqan
picea892 Posted March 28, 2010 Posted March 28, 2010 Hi, Here is another option #Include <WinAPI.au3> #include <Constants.au3> #include <WindowsConstants.au3> $wintitle = "Untitled - Notepad" run("notepad.exe") sleep(1000) $hWnd =WinGetHandle($wintitle,"") $style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) If BitXOR($style,$WS_SIZEBOX,$WS_BORDER) <> BitOr($style,BitXOR($style,$WS_SIZEBOX,$WS_BORDER)) Then _WinAPI_SetWindowLong($hWnd,$GWL_STYLE,BitXOR($style,$WS_SIZEBOX,$WS_BORDER)) $x=WinGetPos($wintitle,"") WinMove($wintitle,"",$x[0],$x[1]+1) _WinAPI_RedrawWindow($hWnd,0,0,BitOR($RDW_ERASE,$RDW_INVALIDATE,$RDW_UPDATENOW,$RDW_FRAME,$RDW_ALLCHILDREN)) ; works, but redraws entire screen.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now