i have written a small form application in c#. I have enabled shortcut key by using low level keyboard hook to give focus to application when needed.
All is working fine, I press the short key i.e. LControlKey+LControlKey for the first time the application get proper control.
But when I deactivate and redo the shortcut key, the icon of the application on the taskbar starts blinking and textbox in the application seems to get the focus(cursor blinking) but the control is still not reached. I say this because when i try to write something nothing gets written on the application.

I am giving focus to the application by using form.Activate() I have also tried from.Visible but with no luck.
Does any have any idea why is this happening?

try form.focus() , may be this will work for you :)


I have tried that its not working.

Here is what i have tried:
1. I have one form class and another operation class. The object of the form class has been passed to the operation class.
2. The logic for implementation of shortcut key is in operation class and when the shortcut key is detected the object of form is used to activate the form.
3. Once form1.activate() is processed the event for form activated is triggered and the respective function is called from inside form class.
4. I have tried using form1.focus() from operation class and in form class both with no luck.
5. I even disabled all the controls present inside the form, but this also didnt help.

Trying all the above still gives the same output. That is, when the form is deactivated or minimized and the shortcut key is used for the 1st time, the form gets activated, with the change in the title bar. Now I take the form out of focus(deactivate or minimize) and again use shortcut key to activate the form, this time the form is not activated and the icon in the taskbar starts blinking.
The proper activation works only once, not after that.

form1.ActiveControl = form1.textBox1