Lots of ways you can do it, but i can't imagine an easier way (if you are homebrewing it up) than IB and their open API.
http://www.interactivebrokers.com/en/software/interfaceComparison.php
They already have code samples of java, C++, VB, Excel DDE, etc code and a demo system to try it...