Jump to content

Recommended Posts

Posted

So let me explain what I'm expecting and trying to accomplish. I'm trying to create a more like parental control gui with the key features. I got the gui going, but not sure how to achieve the following key Features:
- If user have not logged; user will not be able to navigate around. The cursor would be stuck inside the gui until user is logged on. (Need help on this one only. I'm stuck here and not sure how to begin.)
- Disable Ctrl+Alt+Del and or taskmgr if user have not logged on (I can figure this one out.)
- Disable windows key. (I can figure this one out.)
- Get logins from SQL or database. (I can figure this one out.)

Here's my gui code:

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
    $Control = GUICreate("Login", 292, 191, 674, 309)
$inputuser = GUICtrlCreateInput("", 24, 40, 241, 28)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$lname = GUICtrlCreateLabel("Username:", 24, 16, 82, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$lpass = GUICtrlCreateLabel("Password:", 24, 72, 77, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$inputpwd = GUICtrlCreateInput("", 24, 96, 241, 28)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$bLogin = GUICtrlCreateButton("Login", 64, 136, 161, 41)
GUISetState(@SW_SHOW)
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        EndSwitch
WEnd

 

 

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Posted (edited)

Hi @Queener :)

1 hour ago, Queener said:

If user have not logged; user will not be able to navigate around. The cursor would be stuck inside the gui until user is logged on.

I think that you can use _MouseTrap() :)

Try it, and let us know ;)

EDIT: There's a function called BlockInput(), which completely blocks the user input ( Mouse and Keyboard ), but, doing that, the user would not be ever able to Login, since there are no inputs availables.

So, if you want to trap the mouse inside the GUI, you should consider to disable the controls in it too, so the user has the mouse trapped inside the GUI, and can't press any key to leave it ( Alt + Tab and so on... ).

Edited by FrancescoDiMuro
More detailed answer

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted
BlockInput ($BI_DISABLE) ;Keyboard mouse Active.

BlockInput ($BI_ENABLE) ;Keyboard mouse UnActive.

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted

There has to be a way for the program to know if the user is logged in or not.  You dont really want trap a users mouse.... what if they cant log in,  then they have to force your program to shut down bc it wont release control of the mouse.  I'd think a more elegant solution would be to make the login screen the parent window and child window popup after the fact that contained the relevant controls ect.  You could just hide or close the initial window.   That's just my 2c

  • 3 weeks later...

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
×
×
  • Create New...