By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

problem with start external application and hook keyboard

P: n/a
Hi,
I just write an application in C# that show an interface with five
button, each button starts an external application that it comes in
front of the main C# application with focus on. When the users finish
to use the external program and close it, under there is still the c#
application that let the user choose other software to start.
Now the problem is that sometimes I lost the focus of the external
application and so it becomes unsuable, and this happen when after
start the application I continue to press keyboard even if the
application is still loading.
I would like to find a way to disable completely the keyboard for C#
application, to avoid the problem, and then enable keyboard when
external application finish.
I try various way but is seems the problem is still there.

please any good advice?

thanks a lot

May 3 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
There are quite a few ways you could go about solving this problem but
none will be perfect. As I see it you are always going to have trouble
with the application losing focus whether it is to your c# app or
something else. If you can change the app then you could make it so it
always receives key presses whether or not it has focus.

The simplest way to answer your question is to handle the Activate
event in the c# form and then imediatly set the focus back to the
other application using windows messages. I presume you are using
process to start the other application and so will be able to see when
the application exits.

On May 3, 9:09 am, cvaire...@mcgestioni.it wrote:
Hi,
I just write an application in C# that show an interface with five
button, each button starts an external application that it comes in
front of the main C# application with focus on. When the users finish
to use the external program and close it, under there is still the c#
application that let the user choose other software to start.
Now the problem is that sometimes I lost the focus of the external
application and so it becomes unsuable, and this happen when after
start the application I continue to press keyboard even if the
application is still loading.
I would like to find a way to disable completely the keyboard for C#
application, to avoid the problem, and then enable keyboard when
external application finish.
I try various way but is seems the problem is still there.

please any good advice?

thanks a lot

May 3 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.