VB6.0 代码转VB.NET
VB代码PrivateDeclareFunctionGetKeyStateLib"user32"(ByValnVirtKeyAsLong)AsIntegerPrivate...
VB代码 Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long Private Const KEYEVENTF_EXTENDEDKEY = &H1 Private Const KEYEVENTF_KEYUP = &H2 Private Sub SetKeyState(ByVal Key As Long, ByVal State As Boolean) Call keybd_event(Key, MapVirtualKey(Key, 0), KEYEVENTF_EXTENDEDKEY Or 0, 0) Call keybd_event(Key, MapVirtualKey(Key, 0), KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0) End Sub Private Property GET CapsLock() As Boolean CapsLock = GetKeyState(vbKeyCapital) = 1 End Property Private Property Let CapsLock(ByVal Value As Boolean) Call SetKeyState(vbKeyCapital, Value) End Property放到VB.NET报错
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询