Keyloggers are considered malicious , but it actually isn't quite clear whether you mean the same thing as we do with that term.
If you are wondering how to store something, anything, then consider these points:
1) What type of data is it? Keys can actually be bytes, integers, or characters. Bytes are smallest, and might make most sense, but integers might make more sense in some cases.
2) Will the amount of data change? If yes, then a List (of T) would make most sense...probably.
3) Do you need to persist the data over time? In that case, you will want to save the data in memory, then push it out to a file, which could be either binary serialization, text files, XML, or even a database. Which one is best depends largely on what you want to do with the data.
i am using the follwing code to make the keylogger:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function RegisterServiceProcess Lib "Kernel32.dll" (ByVal dwProcessId As Integer, ByVal dwType As Integer) As Integer
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String, ByVal cch As Int32) As Int32
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Shift = GetAsyncKeyState(System.Windows.Forms.Keys.ShiftKey)
keystate = GetAsyncKeyState(System.Windows.Forms.Keys.A)
while debugging keylogger project in vb2010 it show the following error::
A call to PInvoke function 'WindowsApplication1!WindowsApplication1.Form1::GetAsyncKeyState' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.