John

John

  • NA
  • 3
  • 0

Detect if forms opened by mouse click or keyboard shortcut

Oct 3 2006 5:23 AM

In a C#.NET application (.dll automation) I have a form. I need to know if the F6-key is in the state of pressed down, when the form opens. I cannot detect it sooner, because I'm opening it from another application.

I've tried to make a keypresseventhandler, but it does'nt fire on F-keys, only the normal keys (a-z and others). And KeyDown only fires when the key is actually on its way down. I need to read the state of F6, because its pressed down in the other application (in which I've no control and cannot parse any parameters regarding keyboard) but it will still be in a state of pressed down when my own application opens.

The reason is that I'd like to position my form next to the mouse pointer (if it is open by mouseclick on button) or in center of screen (if it is open by keyboard shortcut to the same button).


Answers (2)