Basti756 Posted November 6, 2006 Share Posted November 6, 2006 Hi there, is there a possibilty to keep a GUI on a certain position so that anybody can't move it around by using the mouse? A solution might be to disable the mouse (not mouse AND keyboard) but this feature is not supported by autoit, yet. The cause for my question is that we have to create a totally locked workstation which can be used via RDP by the users but nobody (except our company) should be able to administrate it or perform a local login. So I created this simple GUI which should be started as a service. Whatever... Here is the code: expandcollapse popup#include <GUIconstants.au3> #include <Misc.au3> #NoTrayIcon $dheight = @DesktopHeight $dwidth = @DesktopWidth $picheight = @DesktopHeight-10 $picwidth = @Desktopwidth-10 Dim $password Dim $username Dim $childwin Opt ("GUICloseOnESC", 0) $mainwindow = GUICreate("Blocker",$dwidth,$dheight,0,0,BitAND($WS_DLGFRAME,$WS_MAXIMIZE,$WS_EX_DLGMODALFRAME),$WS_EX_TOOLWINDOW) WinSetOnTop("Blocker","",1) Opt("GUIOnEventMode", 1) GUICtrlCreatePic("C:\WINDOWS\block.jpg",2,2,$picwidth,$picheight) HotKeySet ("xxxxxx","passexit") ;GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState (@SW_SHOW) ;While 1 ; Sleep(1000) ;WEnd While 1 Sleep(1) If ProcessExists ("taskmgr.exe") Then ProcessClose("taskmgr.exe") Wend Func closechild() GUIDelete($childwin) EndFunc Func passexit() $childwin = GUICreate("Password",300,200,$DS_SETFOREGROUND) WinSetOnTop("Password","",1) Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "closechild") GUICtrlCreateLabel("Zum Entsperren geben sie bitte gültige Zugangsdaten an",10,10,280,20) GUICtrlCreateLabel("Benutzername:",10,40,70,20) $username = GUICtrlCreateInput("",10,60,200,23,$ES_PASSWORD) GUICtrlCreateLabel("Passwort",10,93,60,20) $password = GUICtrlCreateInput("",10,113,200,23,$ES_PASSWORD) $cancel = GUICtrlCreateButton("Cancel",10,165,65,25) GUICtrlSetOnEvent( $cancel , "closechild" ) $ok = GUICtrlCreateButton("OK",85,165,65,25) GUICtrlSetOnEvent ( $ok , "loginok" ) GUISetState (@SW_SHOW) EndFunc Func loginok() $usernamestate = GUICtrlRead ( $username ) $passwordstate = GUICtrlRead ( $password ) If $usernamestate = "xxxxxx" AND $passwordstate = "xxxxxx" Then GUIDelete($childwin) Exit Else GUIDelete($childwin) EndIf EndFunc Func CLOSEClicked() Exit EndFunc The Window which is declared as "$mainwindow" is the onee which should not be moved with the mouse. Do you have any ideas? Bastian Link to comment Share on other sites More sharing options...
Uten Posted November 8, 2006 Share Posted November 8, 2006 Monitor $GUI_EVENT_MOUSEMOVE and move your window back? Or create a dumy window that is tiny and on top of the main window and use GuiSwitch to move avay from the main window. Have not tried that one so it is just an idea from the top of my head Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
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