Here is one version of kbhit() using windows API (GetAsyncKeyState). It runs through 255 possible key scancodes in pulses. If a key is pressed, it returns 1 and the value of the key pressed by reference.
This can be used to make a rudimentary keylogger in Windows.
Proof of concept: Keylogger Source code
#include <windows.h>
Call:
int keypressed=0;
char ch=0;
keypressed = kbhit(&ch);