L
Lakshan
Hi,
How do you emulate a key board hit in C# without actually reading in
the character.
For instance I have the following code
Console.WriteLine("Press a enter to exit");
Console.ReadLine();
Instead of doing the above, I want to do something like the
following:
bool bExitFlagSet = false;
//The other thread may set the flag
//to true if certain conditions occur
SpawnAnotherThread();
Console.WriteLine("Press a enter to exit");
while(!kbhit() and (bExitFlagSet == false))
{
//be in the loop until a key press occurs
//or the bExitFlagSet is set to true from another
//thread
Sleep(5000);
}
How do I implement the kbhit() above. I am trying to find a way to
implement this in a console application.
Your help will be greatly appreciated.
Thanks
Lakshan
Lakshan
How do you emulate a key board hit in C# without actually reading in
the character.
For instance I have the following code
Console.WriteLine("Press a enter to exit");
Console.ReadLine();
Instead of doing the above, I want to do something like the
following:
bool bExitFlagSet = false;
//The other thread may set the flag
//to true if certain conditions occur
SpawnAnotherThread();
Console.WriteLine("Press a enter to exit");
while(!kbhit() and (bExitFlagSet == false))
{
//be in the loop until a key press occurs
//or the bExitFlagSet is set to true from another
//thread
Sleep(5000);
}
How do I implement the kbhit() above. I am trying to find a way to
implement this in a console application.
Your help will be greatly appreciated.
Thanks
Lakshan
Lakshan