T
Tritech
Our company has a 16bit command line application that works fine under XP
and was working fine under Vista until, we believe, service pack 1 was
installed. The program works initially to accept keyboard input but seems to
ignore any keyboard input after a few minutes of the PC being left with no
activity. We have tested this on Windows Vista and Windows 7 and have
exactly the same issue. We have created a very basic program that would
allow you to type characters and exit when Enter is pressed. I have narrowed
the time delay before the program freezes down to about 4 minutes of
inactivity. This will cause the program to not respond to any key presses on
the keyboard and has to be closed by clicking on the x in the top right
corner.
I am wondering if anyone else is having this issue and also if there is a
fix for this? (Perhaps a registry key timeout setting?)
Below is a copy of the source code we used for our simple program. The
program is written in Microsoft C version 5. We are using an Int 16h
Function 00h BIOS call to read the keyboard character. Any help on this
would be greatly appreciated. If you need the .exe file or the source code
as a file then let me know and I can email to you.
#include <string.h>
#include <bios.h>
static void BVsetcpos(int row, int col);
static void BVwtac(int amt, int chr, int att);
static int BKread(int *scanp);
#define A_NORM 0x07
#define A_INTENSE 0x0F
#define A_INVERSE 0x70
/* DOS Video */
#define DOS_VIDEO 0x10 /* DOS Interrupt */
#define F_SETCPOS 0x02 /* AX */
#define F_WTAC 0x09 /* AX */
/* DOS Keyboard */
#define DOS_KBD 0x16 /* DOS Interrupt */
#define F_READ 0x00 /* AX */
int nextch = 0; /* extended character code saved from
keyboard read */
void main(int argc, char *argv[])
{
int ch;
int row, col;
row = col = 10;
do {
BVsetcpos(row, col);
ch = BKread(&nextch);
if (ch >=' ' && ch <='~') {
BVwtac(1, ch, A_INTENSE);
if (col < 79) col++;
}
} while (ch != 10 && ch != 13);
}
/*--------------------------------------------------------------------------
--
NKread - read keyboard character and scan code
----------------------------------------------------------------------------
*/
static int BKread(int *scanp)
{
union REGS inr, outr;
inr.h.ah = F_READ; // F_READ == 0x00
int86(DOS_KBD, &inr, &outr); // DOS_KBD == 0x16
*scanp = outr.h.ah;
return ((int)outr.h.al);
}
/*--------------------------------------------------------------------------
--
BVsetcpos - set cursor position
----------------------------------------------------------------------------
*/
static void BVsetcpos(int row, int col)
{
union REGS inr, outr;
inr.h.ah = F_SETCPOS; // F_SETCPOS == 0x02
inr.h.dh = (unsigned char)row;
inr.h.dl = (unsigned char)col;
inr.h.bh = 0;
int86(DOS_VIDEO, &inr, &outr); // DOS_VIDEO == 0x10
}
/*--------------------------------------------------------------------------
--
BVwtac - write attribute and character
----------------------------------------------------------------------------
*/
static void BVwtac(int amt, int chr, int att)
{
union REGS inr, outr;
inr.h.ah = F_WTAC; // F_WTAC == 0x09
inr.h.al = (unsigned char)chr;
inr.h.bh = 0;
inr.h.bl = (unsigned char)att;
inr.x.cx = (unsigned)amt;
int86(DOS_VIDEO, &inr, &outr); // DOS_VIDEO == 0x10
}
and was working fine under Vista until, we believe, service pack 1 was
installed. The program works initially to accept keyboard input but seems to
ignore any keyboard input after a few minutes of the PC being left with no
activity. We have tested this on Windows Vista and Windows 7 and have
exactly the same issue. We have created a very basic program that would
allow you to type characters and exit when Enter is pressed. I have narrowed
the time delay before the program freezes down to about 4 minutes of
inactivity. This will cause the program to not respond to any key presses on
the keyboard and has to be closed by clicking on the x in the top right
corner.
I am wondering if anyone else is having this issue and also if there is a
fix for this? (Perhaps a registry key timeout setting?)
Below is a copy of the source code we used for our simple program. The
program is written in Microsoft C version 5. We are using an Int 16h
Function 00h BIOS call to read the keyboard character. Any help on this
would be greatly appreciated. If you need the .exe file or the source code
as a file then let me know and I can email to you.
#include <string.h>
#include <bios.h>
static void BVsetcpos(int row, int col);
static void BVwtac(int amt, int chr, int att);
static int BKread(int *scanp);
#define A_NORM 0x07
#define A_INTENSE 0x0F
#define A_INVERSE 0x70
/* DOS Video */
#define DOS_VIDEO 0x10 /* DOS Interrupt */
#define F_SETCPOS 0x02 /* AX */
#define F_WTAC 0x09 /* AX */
/* DOS Keyboard */
#define DOS_KBD 0x16 /* DOS Interrupt */
#define F_READ 0x00 /* AX */
int nextch = 0; /* extended character code saved from
keyboard read */
void main(int argc, char *argv[])
{
int ch;
int row, col;
row = col = 10;
do {
BVsetcpos(row, col);
ch = BKread(&nextch);
if (ch >=' ' && ch <='~') {
BVwtac(1, ch, A_INTENSE);
if (col < 79) col++;
}
} while (ch != 10 && ch != 13);
}
/*--------------------------------------------------------------------------
--
NKread - read keyboard character and scan code
----------------------------------------------------------------------------
*/
static int BKread(int *scanp)
{
union REGS inr, outr;
inr.h.ah = F_READ; // F_READ == 0x00
int86(DOS_KBD, &inr, &outr); // DOS_KBD == 0x16
*scanp = outr.h.ah;
return ((int)outr.h.al);
}
/*--------------------------------------------------------------------------
--
BVsetcpos - set cursor position
----------------------------------------------------------------------------
*/
static void BVsetcpos(int row, int col)
{
union REGS inr, outr;
inr.h.ah = F_SETCPOS; // F_SETCPOS == 0x02
inr.h.dh = (unsigned char)row;
inr.h.dl = (unsigned char)col;
inr.h.bh = 0;
int86(DOS_VIDEO, &inr, &outr); // DOS_VIDEO == 0x10
}
/*--------------------------------------------------------------------------
--
BVwtac - write attribute and character
----------------------------------------------------------------------------
*/
static void BVwtac(int amt, int chr, int att)
{
union REGS inr, outr;
inr.h.ah = F_WTAC; // F_WTAC == 0x09
inr.h.al = (unsigned char)chr;
inr.h.bh = 0;
inr.h.bl = (unsigned char)att;
inr.x.cx = (unsigned)amt;
int86(DOS_VIDEO, &inr, &outr); // DOS_VIDEO == 0x10
}