1

i have created simple windows application. when it runs i set its Visible property to false; And now i want to make it Visible when conbination of keys pressed with

AEMLoviji
  • 3,217
  • 9
  • 37
  • 61
  • It could indeed be closed as a duplicate of that, but the accepted answer there is not the way to go. The other answer by Thomas Levesque there is a good one though. –  Aug 13 '12 at 14:02
  • @John Koerner, yout link helped me. there i foud it http://www.liensberger.it/web/blog/?p=207 . sample works great. Thanks... – AEMLoviji Aug 14 '12 at 05:56

1 Answers1

1

You need to create Keyboard Hook. As noticed in the article, there is a very usefull project on the CodePlex that you can use to solve your issue.

ie.
  • 5,982
  • 1
  • 29
  • 44
  • 3
    A keyboard hook is probably overkill, and suffers from the "what if two programs did this?" problem: depending on what you do, either multiple programs react to the same key press, or your program silently breaks the other program. `RegisterHotkey` is the way to go instead, it gives an error if a program attempts to register a hotkey that is already registered, allowing you to choose a different one instead. –  Aug 13 '12 at 14:00
  • @hvd right, `RegisterHotkey` looks even more suitable for such cases – ie. Aug 13 '12 at 14:07
  • 1
    RegisterHotkey doesn't work in a console mode app, a message loop is required. – Hans Passant Aug 13 '12 at 15:18
  • @HansPassant oh, thanks! I and hvd did not know about it! will know! – ie. Aug 13 '12 at 15:19
  • @HansPassant There's no reason why a console mode application can't have a message loop. –  Aug 13 '12 at 16:25
  • as i said, i converted application from console to windows. not RegisterHotkey do all for me – AEMLoviji Aug 15 '12 at 05:47