Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Convert.ToChar(65)
- ChrW(70)
- (char) 70
- Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
- Public sub harry()
- For i = 1 to 255
- If Chr(i) = Convert.ToChar(Keys.Enter) Then
- Label1.Text &= " [Enter] "
- ElseIf Chr(i) = Convert.ToChar(Keys.Delete) Then
- Label1.Text &= " [Delete] "
- End If
- Next i
- End Sub
- Private Sub StartValue_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles StartValue.KeyPress
- If ChrW(13).ToString = e.KeyChar And StartValue.Text = "" Then
- StartValue.Text = "0"
- End If
- End Sub
- Imports System.Runtime.InteropServices
- Public Class KeyCodeToAscii
- <DllImport("User32.dll")> _
- Public Shared Function ToAscii(ByVal uVirtKey As Integer, ByVal uScanCode As Integer, ByVal lpbKeyState As Byte(), ByVal lpChar As Byte(), ByVal uFlags As Integer) As Integer
- End Function
- <DllImport("User32.dll")> _
- Public Shared Function GetKeyboardState(ByVal pbKeyState As Byte()) As Integer
- End Function
- Public Shared Function GetAsciiCharacter(ByVal uVirtKey As Integer) As Char
- Dim lpKeyState As Byte() = New Byte(255) {}
- GetKeyboardState(lpKeyState)
- Dim lpChar As Byte() = New Byte(1) {}
- If ToAscii(uVirtKey, 0, lpKeyState, lpChar, 0) = 1 Then
- Return Convert.ToChar((lpChar(0)))
- Else
- Return New Char()
- End If
- End Function
- End Class
Add Comment
Please, Sign In to add comment