A new proof of the Szeged-Wiener theorem