CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: ALT+CTL+DEL

  1. #1
    Join Date
    Jun 2000
    Posts
    104

    ALT+CTL+DEL

    HOW CAN I TRAP ALT+CTL+DEL?
    THANKS IN ADVANCE


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: ALT+CTL+DEL

    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]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Jun 2000
    Posts
    104

    Re: ALT+CTL+DEL

    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.


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: ALT+CTL+DEL

    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]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured