Board logo

标题: 请教:怎样屏蔽系统热键? [打印本页]

作者: VB菜鸟    时间: 2005-7-14 21:02     标题: 请教:怎样屏蔽系统热键?

问题如标题,多谢了!!!
作者: Nothing    时间: 2005-7-14 21:04

Private Sub Form_Load()
Command1.Caption = "屏蔽"
End Sub

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 Const SPI_SCREENSAVERRUNNING = 97
Private Sub Command1_Click()
    Dim r As Integer
    Dim p As Boolean
    If Command1.Caption = "屏蔽" Then
        '使Ctrl+Alt+Del有效
        r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, p, 0)
        Command1.Caption = "有效"
    Else
        '使Ctrl+Alt+Del无效
        r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, p, 0)
        Command1.Caption = "屏蔽"
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim r As Integer
    Dim p As Boolean
    '退出前使ALT+CTL+DEL有效
    r = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, p, 0)
End Sub
作者: Nothing    时间: 2005-7-14 21:05

'''在模块中.声名API直接调用就可以了
Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" (ByVal uAction _
As Long, ByVal uParam As Long, ByVal lpvParam As Any, _
ByVal fuWinIni As Long) As Long

Sub DisableCtrlAltDelete(bDisabled As Boolean)
    ' Disables Control Alt Delete Breaking as well as Ctrl-Escape
    Dim x As Long
    x = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub

在程序中直调接用就可以了

Private Sub Command1_Click()
DisableCtrlAltDelete True
End Sub




欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/) Powered by Discuz! 6.0.0