>>>I am a moderator, <fx - spooky echo> I monitor EVERYTHING... THING... Thing..... thing.......</fx>
Well, I learn something new every day. I don't have the actual complete application because it is in with slew of programs. But, I have been testing trying to interrupt read console input with the small application from your Win32 Console Application site. DJGPP has the alarm() function. But it seems that going to Win32 that it is not available any more. We have been using the libraries and include files from DevC++. We have been able to get the ReadConsoleInput working great, but like I said, we have to interrupt it in order to update the screen. Here is the code I am testing with. I have been experimenting with SetTimer().
Code:
#include <windows.h>
#include <stdio.h>
void my_alarm_routine()
{
MessageBox(NULL,TEXT("Test Box 1"),TEXT("TEST"),0);
SetTimer(NULL,NULL,5000,(TIMERPROC) my_alarm_routine);
}
int main()
{
HANDLE hIn;
HANDLE hOut;
COORD KeyWhere;
COORD MouseWhere;
COORD EndWhere;
BOOLEAN Continue = TRUE;
int KeyEvents = 0;
int MouseEvents = 0;
INPUT_RECORD InRec;
DWORD NumRead;
hIn = GetStdHandle(STD_INPUT_HANDLE);
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
// cout << "Key Events : " << endl;
// cout << "Mouse Events : " << flush;
printf("Key Events : \n");
printf("Mouse Events : ");
KeyWhere.X = 15;
KeyWhere.Y = 0;
MouseWhere.X = 15;
MouseWhere.Y = 1;
EndWhere.X = 0;
EndWhere.Y = 3;
SetTimer(NULL,NULL,5000,(TIMERPROC) my_alarm_routine);
while (Continue)
{
ReadConsoleInput(hIn,
&InRec,
1,
&NumRead);
switch (InRec.EventType)
{
case KEY_EVENT:
++KeyEvents;
SetConsoleCursorPosition(hOut,
KeyWhere);
// cout << KeyEvents << flush;
printf("%d",KeyEvents);
if (InRec.Event.KeyEvent.uChar.AsciiChar == 'x')
{
SetConsoleCursorPosition(hOut,
EndWhere);
// cout << "Exiting..." << endl;
printf("Exiting...\n");
Continue = FALSE;
}
break;
case MOUSE_EVENT:
++MouseEvents;
SetConsoleCursorPosition(hOut,
MouseWhere);
// cout << MouseEvents << flush;
printf("%d",MouseEvents);
break;
}
}
return 0;
}
Once again, Thanks for you time.
Kendal