i want to develop the keycounter , i mean i want to get the total no. of key pressed by the user in the specific time , i have a code of keylogger , i can use it to get the text in that time period and after that just get its length , but i dont want to use this . here is a code of VB.net which i found so for on msdn
Private Shared keyPressCount As Long = 0 Private Shared backspacePressed As Long = 0 Private Shared returnPressed As Long = 0 Private Shared escPressed As Long = 0 Private Sub myKeyCounter(ByVal sender As Object, ByVal ex As KeyPressEventArgs) Select Case ex.KeyChar ' Counts the backspaces. Case ControlChars.Back backspacePressed = backspacePressed + 1 ' Counts the ENTER keys. Case ControlChars.Lf returnPressed = returnPressed + 1 ' Counts the ESC keys. Case Convert.ToChar(27) escPressed = escPressed + 1 ' Counts all other keys. Case Else keyPressCount = keyPressCount + 1 End Select textBox1.Text = backspacePressed & " backspaces pressed" & _ ControlChars.Lf & ControlChars.Cr & escPressed & _ " escapes pressed" & ControlChars.CrLf & returnPressed & _ " returns pressed" & ControlChars.CrLf & keyPressCount & _ " other keys pressed" & ControlChars.CrLf ex.Handled = True End Sub 'myKeyCounter
Public Sub New() InitializeComponent() AddHandler TextBox1.KeyPress, AddressOf myKeyCounter End Sub 'New
i get this code from this link Click Here. this code working fine but only when my i am typing on my textbox1 , i want to count all the keys pressed on any part of the screen .
if possible then please help me to solve this issue ,you can help me in C# the code of C# you can find on the above link,
and suggestion will be highly appreciated.