FWIW, if I plug headphones into my computer I get a volume control
dialog opening automatically. So some soundcards do in fact know if
something has been plugged in or not. How this is done, I'm not sure,
and I don't even know if it's a feature on all soundcards.
The "card" in question is an intel one integrated onto the motherboard.