Note: There\'s a very similar question, but it\'s WPF-specific; this one is not.
How can I determine if the current application is activ
Handle the Activated event of your main application Form.