符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
在窗体的on key press \ on key down事件里面判断,并根据你的限制条件决定是否show你的窗体
创新互联公司自2013年起,是专业互联网技术服务公司,拥有项目做网站、成都做网站网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元兴宁做网站,已为上家服务,为兴宁各地企业和个人服务,联系电话:18982081108
用API GetKeyboardState ,判断所有的键里哪些被按下了。
下面的是判断键盘灯的状态
Public Class NativeMethods
Private Shared keyState() As Byte
DllImport("user32.dll") _
Private Shared Function GetKeyboardState(ByVal keyState() As Byte) As Boolean
End Function
Private Shared Sub Update()
keyState = New Byte(256) {}
Dim result As Boolean = GetKeyboardState(keyState)
' Check for error:
If result = False Then
Debug.WriteLine("GetKeyBoardState error: " Marshal.GetLastWin32Error)
Throw New Exception("GetKeyBoardState error: " Marshal.GetLastWin32Error)
End If
End Sub
Public Enum LightState
Off
[On]
End Enum
' Example - the keyboard lights...
Public Shared ReadOnly Property CapsLockState() As LightState
Get
Update()
Dim isOn As Boolean = (keyState(Keys.CapsLock) = 1)
Return IIf(isOn, LightState.On, LightState.Off)
End Get
End Property
Public Shared ReadOnly Property NumLockState() As LightState
Get
Update()
Dim isOn As Boolean = (keyState(Keys.NumLock) = 1)
Return IIf(isOn, LightState.On, LightState.Off)
End Get
End Property
Public Shared ReadOnly Property ScrollLockState() As LightState
Get
Update()
Dim isOn As Boolean = (keyState(Keys.Scroll) = 1)
Return IIf(isOn, LightState.On, LightState.Off)
End Get
End Property
End Class
这就要调用API函数了 给你代码吧 记得给点分啊
Private Const KeysM = H8000
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Me.Text = e.KeyValue
If e.KeyValue = Keys.ShiftKey And GetAsyncKeyState(160) And KeysM Then
MsgBox("你按的是左SHIFT")
ElseIf e.KeyValue = Keys.ShiftKey And GetAsyncKeyState(161) And KeysM Then
MsgBox("你按的是右SHIFT")
End If
End Sub
窗体内检测按键
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.KeyPreview = True '注册窗体的键盘事件
End Sub
在TextBox1中显示按键代码
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
TextBox1.Text = Str(e.KeyCode) + vbCrLf
End Sub
窗体没有焦点,用窗体监测键盘输入缓冲区可以解决,但这似乎可以用于监测用户输入内容,不要用于非法目的呀!所以就是知道也不会告诉你的。