功 能: 檢查存儲單元
用 法: char peekb (int segment, unsigned offset);
segment為段基地址,offset偏移地址。
程序例:
#include
#include
#include
int main(void)
{
int value = 0;
printf("The current status of your keyboard is:\n");
value = peekb(0x0040, 0x0017);
if (value & 1)
printf("Right shift on\n");
else
printf("Right shift off\n");
if (value & 2)
printf("Left shift on\n");
else
printf("Left shift off\n");
if (value & 4)
printf("Control key on\n");
else
printf("Control key off\n");
if (value & 8)
printf("Alt key on\n");
else
printf("Alt key off\n");
if (value & 16)
printf("Scroll lock on\n");
else
printf("Scroll lock off\n");
if (value & 32)
printf("Num lock on\n");
else
printf("Num lock off\n");
if (value & 64)
printf("Caps lock on\n");
else
printf("Caps lock off\n");
return 0;
}
http://baike.baidu.com/view/1983818.html?fromTaglist
沒有留言:
張貼留言