NO MOVE NO SIZE

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
pantik
Junior Coder
Posts: 45
Joined: Sun Dec 13, 2009 5:52 pm

NO MOVE NO SIZE

Post by pantik » Mon Oct 05, 2015 6:51 pm

Code: Select all

  SRT>StayOnTop
    Let>HWND_TOPMOST=-1
    Let>HWND_NOTOPMOST=-2
    Let>SWP_NOSIZE=1
    Let>SWP_NOMOVE=2
    Let>SWP_NOACTIVATE=16
    Let>SWP_SHOWWINDOW=64
    Let>WindowHandle=%StayOnTop_var_1%
    Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
    LibFunc>User32,SetWindowPos,swpr,%WindowHandle%,HWND_TOPMOST,0,0,0,0,Flags
    END>StayOnTop
I found this code to not allow a windows lose the focus. How can i use this in some way to not allow windows size changes or windows position changes ??'
The point is not to check if the windows was moved or resized before every image recognition command.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: NO MOVE NO SIZE

Post by Marcus Tettmar » Tue Oct 06, 2015 9:36 am

You could try removing the window style that allows sizing:
http://stackoverflow.com/questions/1825 ... emporarily

Don't think you can prevent a window from being moved though. You could perhaps remove it's title bar. But a user could still move it in other ways.

Instead of preventing it from being moved and sized you could just position and size it yourself prior to your image recognition. So even if the user does move or resize it your script would then reposition and resize it. Just use MoveWindow and ResizeWindow commands. Much easier.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts