There are a few C and C++ mouse libraries over at http://www.programmersheaven.com that work very well.

Just search the archives for 'mouse library'.