I have form named Form1. I set Hotkey Ctrl + G do:
Show();
Active();
TopMost = true;
TopMost = false;
TextBox1.Focus();
While I'm typing in Notepad, I press that hotkey, my Form1 appeared, like this:

Both Notepad and Form1 have text cursor, but when continue typing, Form1.TextBox1 doesnt get input, but Notepad get.
But when open solution by Visual Studio and Debugging (F5), my Form1 get input, and Notepad doesnt.
Can you help me solve this problem? Thank you very much!
Try calling ShowWindowAsync and SetForegroundWindow from your WinForms process on itself as outlined here:
http://weimenglee.blogspot.com/2007/01/programmatically-switch-to-another.html
It seems that notepad is still the active application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With