problem with start external application and hook keyboard

C

cvairetti

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
 
O

Olie

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top