Determining whether your PC is infected or not is rather difficult by the data giving, that it stopped usually means that it's not a danger to your PC now, but one never knows what it mightn't have found.
(Unfortunately I can't remember any of the generally recommended pages to get an online check up.)
Btw, it might also be possible that your Yahoo account wasn't hacked, but a virus on your system captured your address book and send out those emails from your PC.

Your modem is internal, isn't it? An external one wouldn't have the off/on issue, since it's a matter of having energy not a matter of requiring a special modem.
If you get a new one try to get one with a router and a hardware firewall. A hardware firewall would stop certain kinds of attacks and security problems before they ever come near your PC.