How to control "Listen to this Device" feature of Windows 7 programmatically?

This is not possible - there is no public API available to control “Listen to this Device” feature. The feature can only be controlled by the user in the Sound control panel.