You can start here
. If that seems too much of an overview, drill down to low-level input. Essentially, every keypress generates a signal which is mapped into a virtual key code. Intervening software, such as your C/C++ run-time libraries will deal with these and give you the somewhat limited functions that you have there. You can deal with them directly. In addition to getting the codes, or reacting with key events, you can also deal with such things as key repeat and mouse events. The conio functions that you find with some compilers, such as Dev-Cpp, base their rawer functions on this API, while modeling them after the old Turbo C stuff.
Even though Windows doesn't have the nice signalling functions that one finds in Unix, you can pick up on events like someone clicking the big 'X', or logging off, or whatever, and try to gracefully shut down your program.