0

I'm using this solution(first answer) to make hotkeys. So, it has event handler method :

static void HotKeyManager_HotKeyPressed(object sender, HotKeyEventArgs e)
{
  Console.WriteLine("Hit me!");
}

How to get an instance of my form there? I tried making form a static field of class with main method, but I have System.ArgumentException: Controls created on one thread cannot be parented to a control on a different thread. How to do it?

Community
  • 1
  • 1
lenden
  • 800
  • 2
  • 14
  • 38
  • I guess there's something threaded, you need to use `Invoke` if it's the case – Alvin Wong Jul 09 '12 at 14:18
  • 1
    The example you used is only appropriate for a console mode program. Check this example for a Winforms app, the C# version is further down the page: http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/2622427d-1e15-4f30-b01d-57b0ba054f5c/ – Hans Passant Jul 09 '12 at 18:03

0 Answers0