HOW CAN I TRAP ALT+CTL+DEL?
THANKS IN ADVANCE
Printable View
HOW CAN I TRAP ALT+CTL+DEL?
THANKS IN ADVANCE
Use the Keycode function in the Keydown event and if the Control key is pressed then Keycode = 0 and
exit the subroutine. See the VB help file on Keycode.
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
Dim ShiftDown, AltDown, CtrlDown, Txt
Const KEY_F2 = &H71 ' Define constants.
Const SHIFT_MASK = 1
Const CTRL_MASK = 2
Const ALT_MASK = 4
ShiftDown = (Shift And SHIFT_MASK) > 0
AltDown = (Shift And ALT_MASK) > 0
CtrlDown = (Shift And CTRL_MASK) > 0
If CtrlDown Then
'MsgBox "Control key pressed"
KeyCode = 0
End If
End sub
'This is how you can trap that the key is pressed. If you want to know how to disable it let me know
Iouri Boutchkine
[email protected]
thanks for the reply.yes i want to know how to disable it.i do not want the system to do what it actually does when this combination is pressed.
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (byval _
uAction as Long, byval uParam as Long, byref lpvParam as Any, byval fuWinIni as Long) as Long
private Const SPI_SCREENSAVERRUNNING = 97
private Sub Form_Load()
'Disable HotKeys, including. CTRL+ALT+DEL and ALT+TAB
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, byval 0&, 0&)
End Sub
'ReEnable HotKeys
private Sub Form_Unload(Cancel as Integer)
Call SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, byval 0&, 0&)
End Sub
'====disable only Ctrl-Alt-Del========
Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(SPI_SCREENSAVERRUNNING, bDisabled, CStr(1), 0)
End Sub
Iouri Boutchkine
[email protected]