[DllImport("user32.dll", SetLastError = true)]
static extern Int16 GetAsyncKeyState(UInt16 virtualKeyCode);
private void backGroundWorker1_RunWorkerAsync(...)
{
while (true)
{
if (GetKeyState( your vk key in bytes (eg. 0x2D - VK_INSERT) ) < 0)
{
// you get here when your key is pressed
}
System.Threading.Thread.Sleep(50);
}
}
public void hotkeyTest()
{
Boolean hotkey1;
hotkey1 = GetAsyncKeyState(Keys.Multiply);
if (hotkey1 == true)
{
//your event
}
}
private void tHotkey1_Tick(object sender, EventArgs e)
{
hotkeyTest();
}