okay
19-10-2003, 21:15
La domanda č questa:
Ho una routine per il mouse, e vorrei uscire dal ciclo premendo il tasto ESC invece che premere un tasto qualsiasi..........
se metto la routine di controllo:
do {
}while (getch()!=27)
//non posso usare la routine del mouse!!!!!!!
se la lascio cosė come č esco dal ciclo premendo un qualsiasi tasto
Vorrei invece intercettare solo iltasto ESC ed uscire dal cilco
come posso fare??????
-----------routine------------------
void mouse()
{
clrscr();
int x_pos,y_pos,press,count;
// Graphics_On();
Draw_Title(150,2,490,3,1,7,0);
Draw_Title(150,9,151,78,1,0,7);
Draw_Title(150,78,490,79,1,7,0);
Draw_Title(487,9,490,78,1,0,7);
gotoxy(29,10);
textcolor(15);
printf("C Programming : Control Mouse");
gotoxy(13,12);
printf("Press any key to exit");
Reset_Mouse();
Show_Cursor();
do{
Mouse_Position(&x_pos,&y_pos);
gotoxy(1,10);
printf("Position of Mouse:[%.3d %.3d]",x_pos,y_pos);
if(Left_Click(&press,&x_pos,&y_pos))
{
if(press==1)
{
gotoxy(1,9);
textcolor(15);
printf("Press button at:[%.3d %.3d]",x_pos,y_pos);
gotoxy(7,9);
textcolor(10);
printf("Left");
textcolor(15);
}
if(press==1 && x_pos==0 && y_pos==0)
{
goto fine;
}
}
if(Right_Click(&press,&x_pos,&y_pos))
{
if(press==2)
{
gotoxy(1,9);
textcolor(15);
printf("Press button at:[%.3d %.3d]",x_pos,y_pos);
gotoxy(7,9);
textcolor(12);
printf("Right");
textcolor(15);
}
}
} while(!kbhit());
//FINE MOUSE
fine:
DisplayMenu();
}
Ho una routine per il mouse, e vorrei uscire dal ciclo premendo il tasto ESC invece che premere un tasto qualsiasi..........
se metto la routine di controllo:
do {
}while (getch()!=27)
//non posso usare la routine del mouse!!!!!!!
se la lascio cosė come č esco dal ciclo premendo un qualsiasi tasto
Vorrei invece intercettare solo iltasto ESC ed uscire dal cilco
come posso fare??????
-----------routine------------------
void mouse()
{
clrscr();
int x_pos,y_pos,press,count;
// Graphics_On();
Draw_Title(150,2,490,3,1,7,0);
Draw_Title(150,9,151,78,1,0,7);
Draw_Title(150,78,490,79,1,7,0);
Draw_Title(487,9,490,78,1,0,7);
gotoxy(29,10);
textcolor(15);
printf("C Programming : Control Mouse");
gotoxy(13,12);
printf("Press any key to exit");
Reset_Mouse();
Show_Cursor();
do{
Mouse_Position(&x_pos,&y_pos);
gotoxy(1,10);
printf("Position of Mouse:[%.3d %.3d]",x_pos,y_pos);
if(Left_Click(&press,&x_pos,&y_pos))
{
if(press==1)
{
gotoxy(1,9);
textcolor(15);
printf("Press button at:[%.3d %.3d]",x_pos,y_pos);
gotoxy(7,9);
textcolor(10);
printf("Left");
textcolor(15);
}
if(press==1 && x_pos==0 && y_pos==0)
{
goto fine;
}
}
if(Right_Click(&press,&x_pos,&y_pos))
{
if(press==2)
{
gotoxy(1,9);
textcolor(15);
printf("Press button at:[%.3d %.3d]",x_pos,y_pos);
gotoxy(7,9);
textcolor(12);
printf("Right");
textcolor(15);
}
}
} while(!kbhit());
//FINE MOUSE
fine:
DisplayMenu();
}