Try this:
If you have anti-virus programs, turn off their active scanning when installing.
If you do not have AV programs and you get a "Code 2" error when installing: if you have Windows XP open the Windows Security Center (either in the control panel, or click the little icon in your toolbar at the bottom of your desktop) and under "Virus Protection" click the "Recommendations" button, then check the "I have an anti-virus program...", then click OK. Close the center and install the game. After installation (you shouldn't have gotten any errors), go to C:\Program Files\GOG.com\Temple of Elemental Evil (or wherever you installed it) and find ToEE3.exe and create a shortcut on your desktop that points to that .exe. Double click your new shortcut and enjoy.
This worked for me on my XP machine, haven't tried it on my Windows 7 machine, but the settings should be similar. If this does not work for you HAHA. Just kidding, if it doesn't work then keep trying. I'll update if I find anything else out.