Author: Jan Leffers
Date: 04:21:03 07/28/03
Go up one level in this thread
I believe the following code (inspired by Crafty) works with consol and Winboard
(it's for Windows. If you use Linux I suggest you look have a look at Crafty).
Regards
Jan Leffers
int CheckInput() {
static int initiering=0;
static int consol;
static HANDLE StdHandle;
DWORD dword;
if (xboard) {
if (!initiering) {
initiering=1;
StdHandle=GetStdHandle(STD_INPUT_HANDLE);
consol=GetConsoleMode(StdHandle,&dword);
if (consol) {
SetConsoleMode(StdHandle,dword &
~(ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT));
FlushConsoleInputBuffer(StdHandle);
}
}
if (consol) {
GetNumberOfConsoleInputEvents(StdHandle,&dword);
return (int)dword<=0 ? 0 : (int)dword;
}
if (PeekNamedPipe(StdHandle,NULL,0,NULL,&dword,NULL))
return (int)dword;
}
return 0;
}
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.