按任意键退出,如何实现
void PrintRGB(void)
{
int i,j;
int s[6];
int Color;
int 1;
POINT Point;
while(1)
{
HDC hDC = GetWindowDC(NULL); //得到鼠标坐标X,Y值
GetCursorPos(&Point);
Color = GetPixel(hDC,Point.x,Point.y); //得到该点RGB值
for(i=0; i<6; i++) //将RGB值转换成可读的16进制数
{
if(i%2 == 0)
{
s[i+1] = Color%16;
Color = Color/16;
}
else if(i%2 == 1)
{
s[i-1] = Color%16;
Color = Color/16;
}
}
printf("R: %x%x G: %x%x B: %x%x \r",s[0],s[1],s[2],s[3],s[4],s[5],s[6]);//打印
ReleaseDC(NULL,hDC); //释放
for( j=0;j<100000000;j++ );//延时
}
}
以上是代码运行后是个死循环,按任意键退出,如何实现??