Okay well I'm trying to make a secondary security system to use on my computer. I made a form with a password field in the middle, the size of the form cover the entire screen and there is no border. But now I'm trying to find a way to remove all possible ways to exit the form without enter the correct password like CTRL+ALT+Del, ALT+F4, CTRL+ESC, CTRL+TAB, WIN KEY, or any of the short keys. I'm using Windows Vista Ultimate and everything I've found is for 98 and XP and won't seem to work. So in other-words I want it to be impossible to exit the form without entering the correct password. If you could help that would be wonderful.
Thanks in advance,
Daniel
Disable ExitingMake it impossible to exit form without password
Page 1 of 1
9 Replies - 1440 Views - Last Post: 02 June 2010 - 02:06 PM
Replies To: Disable Exiting
#2
Re: Disable Exiting
Posted 16 May 2010 - 05:44 PM
danielair, on 16 May 2010 - 04:33 PM, said:
Okay well I'm trying to make a secondary security system to use on my computer. I made a form with a password field in the middle, the size of the form cover the entire screen and there is no border. But now I'm trying to find a way to remove all possible ways to exit the form without enter the correct password like CTRL+ALT+Del, ALT+F4, CTRL+ESC, CTRL+TAB, WIN KEY, or any of the short keys. I'm using Windows Vista Ultimate and everything I've found is for 98 and XP and won't seem to work. So in other-words I want it to be impossible to exit the form without entering the correct password. If you could help that would be wonderful.
Thanks in advance,
Daniel
Thanks in advance,
Daniel
On load have the application disable ctrl alt del
Private Property AwY As Object
Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const SPI_SCREENSAVERRUNNING = 97
Public Sub Disable_Ctrl_Alt_Del()
'Disables the Crtl+Alt+Del
Dim AyW As Integer
Dim TurFls As Boolean
AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
End Sub
And then disable the task bar as well.
This post has been edited by JynxRD: 16 May 2010 - 05:45 PM
#3
Re: Disable Exiting
Posted 16 May 2010 - 06:11 PM
I had to change it to the following to remove errors, but it still won't work.
Thanks,
Daniel
Private Property AwY() As Object
Get
End Get
Set(ByVal value As Object)
End Set
End Property
Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Boolean, ByVal fuWinIni As Long) As Long
Public Const SPI_SCREENSAVERRUNNING = 97
Public Sub Disable_Ctrl_Alt_Del()
'Disables the Crtl+Alt+Del
Dim AyW As Integer
Dim TurFls As Boolean
AwY = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, TurFls, 0)
End Sub
Thanks,
Daniel
This post has been edited by danielair: 16 May 2010 - 06:16 PM
#4
Re: Disable Exiting
Posted 16 May 2010 - 06:41 PM
Yea I was thinking XP only. Should be different for Vista, Windows7.
-
Actually the more I think about it, it may be more difficult then I'm thinking due to the security in newer versions of Windows. I don't know if I'd want to do it via code honestly. But you'd probably have to create source to edit/create security profiles..etc. But honestly, how is this any different than locking your PC when you leave? Or setting the lock to occur if idle for so long.
-
Actually the more I think about it, it may be more difficult then I'm thinking due to the security in newer versions of Windows. I don't know if I'd want to do it via code honestly. But you'd probably have to create source to edit/create security profiles..etc. But honestly, how is this any different than locking your PC when you leave? Or setting the lock to occur if idle for so long.
This post has been edited by JynxRD: 16 May 2010 - 07:07 PM
#5
Re: Disable Exiting
Posted 17 May 2010 - 11:24 PM
OK, Here's some code which you might find useful...
The code to disable task manager:
And in turn to enable it:
Now, create a new timer on your form, and set the tick to 100. Put this code in the timer_tick event:
Now, go to the FormClosing event of your login form, and add this code:
If you need any more code for anything else, just ask...
The code to disable task manager:
Shell("REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 1 /f", AppWinStyle.Hide)
And in turn to enable it:
Shell("REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 1 /f", AppWinStyle.Hide)
Now, create a new timer on your form, and set the tick to 100. Put this code in the timer_tick event:
For each P as Process in Process.GetProcesses 'You can add any other processes you don't want here, just remember to start them again when the application exits If P.ProcessName = "explorer" then P.Kill Next 'Clip the cursor so it will be confined to the form... Cursor.Clip = Me.RectangleToScreen(Me.ClientRectangle) 'Make sure the form is always topmost... Me.TopMost = True
Now, go to the FormClosing event of your login form, and add this code:
If e.CloseReason = Not CloseReason.WindowsShutDown Then
e.Cancel = True
End If
If you need any more code for anything else, just ask...
#6
Re: Disable Exiting
Posted 26 May 2010 - 02:27 PM
Everything works great I just have one question, how can I protect against someone pressing ALT + F4 and closing the currently open window?
Thanks,
Daniel
Thanks,
Daniel
#7
Re: Disable Exiting
Posted 26 May 2010 - 03:38 PM
Set the form's KeyPreview to True and then:
Private Sub form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.Modifiers = Keys.Alt AndAlso e.KeyCode = Keys.F4 Then
MessageBox.Show("I caught it!")
e.Handled = True
End If
End Sub
#8
Re: Disable Exiting
Posted 26 May 2010 - 05:06 PM
This works fine thanks
But I tried changing the keycode thing to work for CTRL + ALT + DELETE and for some reason it won't work... Any ideas why?
Thanks,
Daniel
Thanks,
Daniel
#9
Re: Disable Exiting
Posted 26 May 2010 - 05:37 PM
There are a lot of people helping you here, think about adding some thanks their way! Especially since you never provided some code initially - which is kind of a rule here.
#10
Re: Disable Exiting
Posted 02 June 2010 - 02:06 PM
It won't work with CTRL + ALT + DEL because it is a global system hook. CTRL + ALT + DEL cannot be intercepted, disabled or tampered with in any way, except by digging deep into your system32 and re-writing a load of MS files. Take a look at this as well. It might be helpfull, but I don't think it will work in Win7 or Vista. Please give some thanks for my posts, as I have spent quite a while on them. If you like someone's post, or it helps you, press the + buton! Thanks!
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|