Ivovh said:
Does anybody know if its possible that write something to the keyboard
buffer. Just like the way a hand barcodescanner works. It passes all the
characters it scanned to the keyboardbuffer and the application that got
the focus picks them up and parse them (for example Excel or notepad)
Yes. In my application i am using this code:
-------------------------------------------------
Imports System.Runtime.InteropServices
Public Const KEYEVENTF_KEYDOWN As Integer = &H0
Public Const KEYEVENTF_KEYPRESS As Integer = &H1
Public Const KEYEVENTF_KEYUP As Integer = &H2
Public Const KEYEVENTF_SILENT As Integer = &H4
Public Const VK_NUMPAD0 As Integer = &H60 '---Numeric keypad 0 key
Public Const VK_NUMPAD1 As Integer = &H61 '---Numeric keypad 1 key
Public Const VK_NUMPAD2 As Integer = &H62 '---Numeric keypad 2 key
Public Const VK_NUMPAD3 As Integer = &H63 '---Numeric keypad 3 key
Public Const VK_NUMPAD4 As Integer = &H64 '---Numeric keypad 4 key
Public Const VK_NUMPAD5 As Integer = &H65 '---Numeric keypad 5 key
Public Const VK_NUMPAD6 As Integer = &H66 '---Numeric keypad 6 key
Public Const VK_NUMPAD7 As Integer = &H67 '---Numeric keypad 7 key
Public Const VK_NUMPAD8 As Integer = &H68 '---Numeric keypad 8 key
Public Const VK_NUMPAD9 As Integer = &H69 '---Numeric keypad 9 key
Public Declare Sub keybd_event Lib "coredll.dll"(_
ByVal bVK As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Integer, _
ByVal dwExtraInfo As Integer)
Public Sub sendtast(ByVal bVk As Byte)
keybd_event(bVk, 0, KEYEVENTF_KEYDOWN, 0) '--Press the key
keybd_event(bVk, 0, KEYEVENTF_KEYUP, 0) '--Release the key
End Sub
-------------------------------------------
Then I can use this in my code (Here I send the '1'):
sendtast(VK_NUMPAD1)
ToreS