Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ReadConsoleInput https://docs.microsoft.com/en-us/windows/console/readconsole...

INPUT_RECORD https://docs.microsoft.com/en-us/windows/console/input-recor...

KEY_EVENT_RECORD https://docs.microsoft.com/en-us/windows/console/key-event-r...

    bKeyDown
    If the key is pressed, this member is TRUE. Otherwise, this member is FALSE (the key is released).
Also, please note that INPUT_RECORD contains union of key, mouse, window buffer size, menu and focus event records. I do not want to say interface is more well thought per se, but it is definitely more rich.


The reason why Windows has this stuff is because it never was particularly supportive of remote terminals. Going back to DOS days, when writing a console app, it was either the kind that only needed print, or else you basically had full control over the screen area, changing individual characters, colors etc in a random access way. The first approach would use DOS output functions that allowed for things like stdout/stderr to work. The second approach couldn't be redirected properly.

Windows inherited that model, and mostly just kept developing it until lately.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: