Window function, Hamming or Hann or whatever are used to smooth the values at the edges of the window in time domain. The purpose is to prevent frequency leakage in freq domain.