R
rege
Hi,
I have two applications developed in C# say A and B. When user presses
key "L" with applicaition A active , it causes a keypress event which
causes application B to run. Application A then waits for application B
to exit. On exit from Application B the focus shifts back to
application A.
The problem is if user presses L more than once, say thrice, then three
keypress events are generated. Therefore application A starts
application B and waits for it to exit. After we exit from B, the
application A processes the second keypress (2nd one of the three) and
application B starts again (which is undesirable!) .
Is there some way by which after the wait for exit we can get rid of
all the queued keypress events??
See the sample code snippet below:
private void ListBox_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar.ToString() == "l")
{
proc = Process.Start(procInfo); //starts application B
proc.WaitForExit(); //waits for B to exit.
//I want to consume all queued up keypress events here.
}
Please help!
Regards
Kshitij
I have two applications developed in C# say A and B. When user presses
key "L" with applicaition A active , it causes a keypress event which
causes application B to run. Application A then waits for application B
to exit. On exit from Application B the focus shifts back to
application A.
The problem is if user presses L more than once, say thrice, then three
keypress events are generated. Therefore application A starts
application B and waits for it to exit. After we exit from B, the
application A processes the second keypress (2nd one of the three) and
application B starts again (which is undesirable!) .
Is there some way by which after the wait for exit we can get rid of
all the queued keypress events??
See the sample code snippet below:
private void ListBox_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar.ToString() == "l")
{
proc = Process.Start(procInfo); //starts application B
proc.WaitForExit(); //waits for B to exit.
//I want to consume all queued up keypress events here.
}
Please help!
Regards
Kshitij