A forms-based VB6 application that runs on XP and Windows Server 2003 fails on Windows 7 with "Unexpected Error", even before the first form is launched.

(I will be answering myself as I've just solved it. I just wanted to pass on the knowledge)