I do alot of scrolling with the aplications i use at work

i was wondering if it would be possible to write something in c or c++ that would let me intercept signals from a trackball to scoll up down left and right but leave my optical mouse to do the regular point and click work


any ideas where to start if its even possible

thanks