K Tan,
After taking a look at your code, it appears that you are using the Harmonic Distortion Analyzer VI correctly, but not the Harmonic Analyzer VI. If you take a look at the detailed help for the Harmonic Analyzer, you must specify the window used for the Scaled Time Domain Waveform VI.
If you take a look at the help for the Harmonic Analyzer VI, you will see the details of how to correctly use this VI to make a THD measurement. I hope this is useful for you. Please post back if you are still having trouble. Thanks,
Mike