There is an excellent article at
http://www.aaroncake.net/electronics/vblpt.htm
Presumably, you would constantly check
BitStatus%(port_number, number_of_bit_corresponding_to_encoder)
I would caution, however, that Windows is not a real-time operating system. You really need to ensure nothing else is running, and avoid doing anything to update the screen, if pulses are less than 50 milliseconds apart.
This is a job better suited to a PLC or real-time operating system.