Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I stop a user to use alt + tab or ctrl + esc 3

Status
Not open for further replies.

harmmeijer

Programmer
Mar 1, 2001
869
CN
I have a form with border style none and on the keydown code checks if a user puts in a certain code (like a password protected screensaver).
The problem is I cannot prevent a user from using alt + tab or ctrl + escape put code in the queryunload to check if the password is filled in and put code in the lostfocus but this event is not fired when using alt + tab or ctrl + escape.
 
Locking the user into your app seems very anti-social to me. Is there a reason for this control?
 
Anti-social or not... sometimes there is a need to control the UI....[tt]

Private Declare Function SystemParametersInfo _
Lib "user32" Alias "SystemParametersInfoA" _
(ByVal uAction As Long, _
ByVal uParam As Long, _
lpvParam As Any, _
ByVal fuWinIni As Long) As Long

Private Sub Form_Load()
[/tt]'Disable system keys...[tt]
RetVal& = SystemParametersInfo(97&, 1&, 0&, 0&)
End Sub

Private Sub Form_Unload(Cancel As Integer)
[/tt]'Enable system keys...[tt]
RetVal& = SystemParametersInfo(97&, 0&, 0&, 0&)
End Sub
[/tt]
VCA.gif

Alt255@Vorpalcom.Intranets.com​
 
I explain why I need it in this case, when I am working on a project in my home my kid likes to toutch the keyboard as soon as I leave the desk (she is 2).
Starting the lock programm is faster than waiting for the screen saver to kick in or move the keyboard and it is verry irritating for the screen saver to activate while you are thinking or looking something up.

The code alt255 gave works perfectly, you`ll get another star thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top