You probably got the trojan/adware etc from downloading from the Gnutella network.
Stick to downloading license free (uncopyrighted) music. Porn and programs will almost certainly have embedded rubbish that you have unfortunatly experienced!
Limeplugged