Control of harmonic generation by initial-state preparation