I need to get the input from the user without pausing the application or having an event. Is there any way that I can get it without events and pausing? Since I have a timer that does other actions and I don't want to add events becuase that will result in messy code. So is there any way to get the key pressed without pausing the app or event?
Thanks.
You could use the User32 API function GetKeyState which allows you to query if a key is pressed. By doing so, you wouldn't need to handle events (or hooks) separately but could do it directly in your timer method.
[DllImport("user32")]
public static extern short GetKeyState(int nVirtKey);
This documentation goes into more detail: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getkeystate
Edit: Here is an example of a method using that:
public static bool LeftCtrlDown()
{
return (User32API.GetKeyState(User32API.VK_LCONTROL) & 0x8000) == 0x8000;
}