Jump to content

Restrict users from changing windows.


PieMan
 Share

Recommended Posts

Does anyone know how i can restric users from changing windows when my GUI is running?

Thanks.

You could create a gui but don't show it. Then get a list of all the windows you don't want anyone to use and set them to have the hidden gui as their parent. They will disappear of the face of the earth. You just have to make sure you set them back to their original parents before your script closes or they will all die when your script ends.

There is an example here, and probably a few others could be found.

Another way you could do it is to take a screen shot of the whole screen, and use that for the background image of a popup window that is also the size of the sccreen, disable the popup window maybe. Then run your gui and set that to be on top. Then the user can click on the other "windows" all he likes but it won't do anything.

#include <ScreenCapture.au3>
#include <guiconstantsEx.au3>
#include <windowsconstants.au3>

; Capture full screen
;but don't capture mouse
_ScreenCapture_Capture ("screen1.jpg", 0, 0, @DesktopWidth, @DesktopHeight, False)

$fake = GUICreate("fake", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
$Img = GUICtrlCreatePic("screen1.jpg", 0, 0, @DesktopWidth, @DesktopHeight)

;show but without flickering
WinSetTrans($fake, "", 0)
GUISetState()
WinSetTrans($fake, "", 255)

;now the gui which is in sole control
$gui = GUICreate("real")
GUISetState()
WinSetOnTop($gui, "", 1)

While GUIGetMsg() <> -3
    If Not WinActive($gui) Then WinActivate($gui);Line A

WEnd

But this means the other windows won't be showing their correct states if these should change after your script starts, and maybe LineA is all you need.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...