为什么我菜单程序按上下键怎么没有反应呢?求帮助啊!
#include <process.h>#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#define Key_DOWN 0x5100
#define Key_UP 0x4900
#define Key_A 0x1e41
#define Key_a 0x1e61
#define Key_B 0x3042
#define Key_b 0x3062
#define Key_C 0x2e43
#define Key_c 0x2e63
#define Key_E 0x1245
#define Key_e 0x1265
#define Key_ENTER 0x1c0d
main()
{
int ky,y;
char ch;
textbackground(0);
clrscr();
do
{
textmode(C80);
textbackground(13);
textcolor(RED);
window(7,8,19,15);
clrscr();
textbackground(1);
textcolor(RED);
window(8,9,18,14);
clrscr();
gotoxy(3,3);
cprintf("E:exit\r\n");
gotoxy(3,4);
cprintf("A:dir\r\n");
gotoxy(3,5);
cprintf("B:dir/p\r\n");
gotoxy(3,6);
cprintf("C:dir/w\r\n");
y=10;
upbar(y-1);
do
{
ky=bioskey(0);
switch(ky)
{
case Key_A:
case Key_a:
{
y=12;
ky=Key_ENTER;
break;
}
case Key_B:
case Key_b:
{
y=13;
ky=Key_ENTER;
break;
}
case Key_C:
case Key_c:
{
y=14;
ky=Key_ENTER;
break;
}
case Key_E:
case Key_e:
{
y=11;
ky=Key_ENTER;
break;
}
case Key_DOWN:
{
if(y<13)
{
upbar(y);
y++;
}
break;
}
case Key_UP:
{
if(y>10)
{
downbar(y);
y--;
}
break;
}
}
}while(ky!=Key_ENTER);
textbackground(WHITE);
switch(y)
{
case 11:
{
ch='%';
break;
}
case 12:
{
system("dir");
getch();
break;
}
case 13:
{
system("dir/p");
getch();
break;
}
case 14:
{
system("dir/w");
getch();
break;
}
}
if(ch=='%')
break;
}while(1);
clrscr();
}
upbar(int y)
{
int i;
typedef struct texel_struct
{
unsigned char ch;
unsigned char attr;
}texel;
texel t;
for(i=9;i<=17;i++)
{
gettext(i,y,i,y,&t);
t.attr=0x1f;
puttext(i,y,i,y,&t);
gettext(i,y+1,i,y+1,&t);
t.attr=0x4f;
puttext(i,y+1,i,y+1,&t);
}
gotoxy(3,y+1);
return;
}
downbar(int y)
{
int i;
typedef struct texel_struct
{
unsigned char ch;
unsigned char attr;
}texel;
texel t;
for(i=9;i<=17;i++)
{
gettext(i,y,i,y,&t);
t.attr=0x1f;
puttext(i,y,i,y,&t);
gettext(i,y-1,i,y-1,&t);
t.attr=0x4f;
puttext(i,y-1,i,y-1,&t);
}
gotoxy(3,y-1);
return;
}