You have chosen to sponsor your bid up to a maximum amount of .
For a program to insert text blocks in other programs (eg MS Word) I need a VB.NET assembly to monitor the keyboard. The program will later be able to run on a terminal server in user sessions. I want both the DLL and the source code. Then name of the Monitor-Class will be "KeyWatch"
In the following I describe the monitoring class: KeyWatch
EventKey ->Type: Array of Integer
In EventKey I can have one or more deposit keycodes that cause the KeyWatch event.
SplitText ->Type: Array of Integer
In SplitText, I may deposit one or more separators.
Starts monitoring the keyboard
Stops monitoring the keyboard
Prevents further keystrokes.
Removed to prevent the keyboard
Send( text as String ) as Boolean
Send( iKeyCode as Integer [, Repeat as Integer ]) as Boolean
Sends the specified text or KeyCodes to the keyboard. Return True if Successfully.
Add the contents of the clipboard into the program (As if the user presses Strg-V)
So that I can insert graphics as well.
KeyWatch( KeyText as string )
If a key is pressed, which is stored in "EventKey" KeyWatch the event is triggered. The parameter (KeyText) is the text passed that was entered prior to the event are, to a separator that is stored in Split text.
##### If that does not work, I am grateful for every suggestion. #####
Public Class Form1
Dim WithEvents oKW As New KeyWatch
Dim aST(1) as Integer
Dim aEK(0) as integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'The delimiter are the carriage return and the space
aST(0) = vbLF
aST(1) = Asc( " ")
'The event will be triggered by the # sign.
aEK(0) = Asc( "#" )
oKW. SplitText = aST
oKW. EventKey = aEK
'Then monitoring starts
Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me. Disposed
'If the window is closed, the monitoring of the keyboard are stop.
Private Sub KeyWatch( KeyText as String ) Handles oKW. KeyWatch
If (KeyText = "car#" ) then
'Delete (KeyCode 8) the last 4 Chars, the Word "car#"
oKW.Send( 8, 4 )
'Adds the specified text and makes a return.
oKW.Send( "Jetzt soll hier dieser Text stehen!" & vbCrLf )
If the user writes the following text: "The customer gets his car#"
with the touch of the #-sign triggered the event and the text (from right to left) to the first delimiter (space between "his" and "car") passed to the event -> "car#"
I apologize for my bad English, because I understand only the language with a translation program.