You could have ALSO polled one of the PC BIOS serial port interrupts which Windows 3.11 AND later versions have ALL either passed directly to the upper OS or emulated as an internal call.
About 300 lines of code and you are done and that's mostly to do with translating display absolute coordinates to relative window and any relative child graphics user interface objects such as buttons, panels, etc. I did this in the 1980's!
To make mouse programming easier once you had the RS-232 or PS/2 ADB port mouse driver installed you could call a "Fake Interrupt" INT 33h to get the mouse coordinates and mouse button presses via register values.