PDA

View Full Version : Change Icon glitch



Bob Campbell
11-17-2011, 07:13 AM
My install program puts a link to my program in the Start menu as well as creates a desktop short cut. The program runs fine from either place.

But in the properties of the link and shortcut, on a Windows 7 64-bit computer, the link to the icon for the program's link and shortcut is incorrect.

I get an error message:

Windows can't find the file %ProgramFiles%\<my company name>\<my program name>\<my program>.exe.

The error is obvious. It should be:

%ProgramFiles(x86)%\<my company name>\<my program name>\<my program>.exe.

SetupBuilder only has %PROGRAMFILESDIR% for [INSTALLDIR]. There's no place to change the variable.

linder
11-17-2011, 07:32 AM
Bob,

%PROGRAMFILESDIR% points to the 32-bit folder when running in 32-bit mode and to the 64-bit folder when running in 64-bit mode in a x64-bit environment.

BTW, %ProgramFiles% (mentioned in your post) is not a SetupBuilder variable!!!!

Does this help?

Friedrich

Bob Campbell
11-17-2011, 07:39 AM
Hi Friedrich,

Yes, %ProgramFiles% is a Windows variable.

What I'm pointing out is: SB correctly uses %ProgramFiles(x86)% for the target, but incorrectly uses %ProgramFiles% for the icon of the program.

It should also use %ProgramFiles(x86)% for the icon on a 64-bit computer.

Bob

linder
11-17-2011, 07:47 AM
Bob,

I see what you mean. I clicked the "Change Icon..." button on a x64 machine and it displays this %ProgramFiles% item. I don't know where this is coming from because SetupBuilder itself does not set this value. I'll see what we can do here.

Friedrich

linder
11-17-2011, 07:54 AM
Hi Bob,

Yes, I see what you mean. I think Windows set this value automatically (because SetupBuilder does not use %ProgramFiles% at all). And the same happens when you click the "SB7 Developer" desktop shortcut on a x64 machine; it happens in all versions back to the year 2005 (which introduced support for x64).

Thank you for bringing this to our attention. We have to find out how to overwrite the default %ProgramFiles% item.

Friedrich

linder
11-17-2011, 08:16 AM
Interesting. This seems to be caused by a Windows bug:

http://stackoverflow.com/questions/2976489/ishelllinkseticonlocation-translates-my-icon-path-into-program-files-which-i

We'll try to develop a workaround.

Thanks again for bringing this to our attention.

Friedrich

linder
11-17-2011, 09:09 AM
Update: dirty hack added to work around this Windows bug. The workaround will be available in the next maintenance build.

CHANGE : (sync from SB8) [SB#111181] Installer: Before calling the SetIconLocation API to set the location (path and index) of the icon for a Shell link object on x64 operating systems, GetShortPathName is used to work around a Windows x64 bug.

Friedrich

linder
11-21-2011, 10:33 AM
Workaround modified:

CHANGE : (sync from SB8) [SB#111181] Installer: Before calling the SetIconLocation API to set the location (path and index) of the icon for a Shell link object on x64 operating systems when running in 32-bit mode, convert the a Program Files folder item to an environment variable to work around a Windows x64 bug.

Friedrich