In order to solve problems that harmonic detecting algorithm based on instantaneous reactive power theory is poor in real-time performance and cannot detect single-phase harmonic directly, the paper proposed using a sliding-window iterative DFT algorithm to improve real-time performance of harmonic detection, and using self-adaptive sampling algorithm to adjust sampling time automatically so as to decrease calculating errors of FDT in non-synchronous sampling. The simulation result showed that the sliding-window iterative DFT algorithm based on self-adaptive sampling can detect harmonic current real-timely and effectively, and has excellent performances of target following and anti-interference.