Capture audio from the sound card

Hi,

I’m trying to write a program that will capture the sound being given to the sound card by other applications eg winamp or windows media player etc.

How would I go about capturing this stream of data?

There is a lot of information out there on how to capture audio from a mic, but i’ve been unsucessful in trying to adapt that to get audio being sent to the sound card.

Thank you for your time

Meercat