不会吧,要用到DLL?不能简单一点吗?最好在十行代码以内搞定!少用参数,我想学习方法,而不是单纯追求结果!

解决方案 »

  1.   

    用C或汇编可以,但用VB挺难的
      

  2.   

    干脆锁住屏幕算了。'用到的API
    Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    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
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As LongDim nPreviousState As Long   '保存系统环境状态'给屏幕加锁的函数
    Public Sub LockScreen(ByVal szMsg As String)
        Me.Move 0, 0, Screen.Width, Screen.Height
        SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 1 Or 2
        BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, GetDC(0), 0, 0, vbSrcCopy
        Me.ForeColor = vbYellow
        Print szMsg
        Me.ForeColor = vbBlue
        Print szMsg
        Me.ForeColor = vbRed
        Print szMsg
        Me.Show
        SystemParametersInfo 97, True, nPreviousState, 0
    End Sub'给屏幕解锁的函数
    Public Sub UnlockScreen()
        SystemParametersInfo 97, False, nPreviousState, 0
        Me.Hide
    End Sub'这个函数仅在调试程序时使用
    Private Sub Command1_Click()
    UnlockScreen
    End Sub
      

  3.   

    霸屏加屏蔽系统热键
    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 LongSub DisableCtrlAltDelete(bDisabled As Boolean)
         Dim x As Long
         x = SystemParametersInfo(97, bDisabled, CStr(1), 0)
    End SubPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        
            Call DisableCtrlAltDelete(False)
            Unload Me
        
    End Sub
    Private Sub Form_Load()
        Call DisableCtrlAltDelete(True)
        Dim i
        i = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
    End Sub
      

  4.   

    太复杂了,有没有更简单一点的,比如在 Form_KeyDown、下面加上一个不响应的参数?
      

  5.   

    设置Form的KeyPreview=True
    Private Sub Form_KeyPress(KeyAscii As Integer)
    KeyAscii = 0
    End Sub
      

  6.   

    dbcontrols(泰山__抛砖引玉):
    OK,确实如此而已!
      

  7.   

    不好吧?只能屏蔽掉字母和数字键,其他功能键都屏蔽不掉,比如windows的功能键。谁能屏蔽?
      

  8.   

    不好吧?只能屏蔽掉字母和数字键,其他功能键都屏蔽不掉,比如windows的功能键。谁能屏蔽?
      

  9.   

    不行吧?只能屏蔽数字和字母键,其他功能键不屏蔽,比如window的功能键,谁知道能将整个键盘都锁死的方法?