Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

changing icon within Add/Remove Program


6 replies to this topic

gatekeeper

gatekeeper
  • Members
  • 18 posts

Posted 12 March 2003 - 18:34

Hello everyone,
I run couple of setup.exe back to back through a program of my own. Now what I'm experiencing is that under Control panel's Add/Remove Program folder, both the products have the same icons.
Where and How do you specify in your setup, which icon is to be used?

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 12 March 2003 - 21:36

It's specified through the following registry entry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<InstallGUID>\DisplayIcon

of type string whose value is the full path to an icon file (.ICO) or an executable (.EXE).

The <InstallGUID> is set on a per-project basis and can be retrieved by opening your IS project and going to Project | Settings, choosing the Application tab, and noting the value of the GUID field.

Also, there's no built in way to configure this item through IS, so you'll simply need to create this registry value during install time.  I'd suggest at the end of OnFirstUIAfter.

Finally, if want to see how it works, install your product and then play around with the registry before adding the code to your setup.

Hope it helps and have a good day.

NOTE: The icon information does NOT apply to NT4, but adding it won't hurt.  It just won't be displayed/used.  Not sure which Win9x/Me setups make use f it since I haven't done very much with those, but same idea.  Having this extra information won't hurt.


user posted image

gatekeeper

gatekeeper
  • Members
  • 18 posts

Posted 12 March 2003 - 22:00

Thank you, TacoBell. You are a great asset to this site. I go through this site regularly. reading and learning from here. Your fottprints are found everywhere..... Not only that, whereever you have a presence, you add value to the answer.
Thankyou...
I will play with your suggestion and am quite sure that your answer will work.

Ray Gonzales

Ray Gonzales
  • Members
  • 7 posts

Posted 14 March 2003 - 16:17

Just to add to TacoBell's help:

I've found the following code works for any O/S which makes use of the icon:
#define UNINSTALL_KEY_BASE "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
#define UNINSTALL_KEY UNINSTALL_KEY_BASE+PRODUCT_GUID

// Set Icon to be displayed in 'Add/Remove programs'
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
nvRegValueType = REGDB_STRING;
RegDBSetKeyValueEx(UNINSTALL_KEY, "DisplayIcon", nvRegValueType, TARGETDIR ^ @PRODUCT_KEY + "," + @ICON_ORDINAL, -1);


Where PRODUCT_KEY is the name of the exe I want to use and ICON_ORDINAL is the zero based icon refernce to the exe file.  They are strings defined in my string table.

I call this common code from all my installs and it works for me on 2000 & XP.  As I recall ME & 98 do not make use of the icon.

Hope this is useful.

Ray
Ray Gonzales[br]ray.gonzales@motorola.com[br]http://www.motorola.com

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 14 March 2003 - 16:43

Yeah, that code is along the lines of what I do and would certainly do the job.

@Ray Gonzales: For future reference, the Code tags are useful for embedding code in a post.  Check 'em out.
user posted image

Ray Gonzales

Ray Gonzales
  • Members
  • 7 posts

Posted 17 March 2003 - 20:58

Thanks TacoBell.  I was so thrilled to have something to say for once, the thought didn't even cross my mind.

Regards,

Ray
Ray Gonzales[br]ray.gonzales@motorola.com[br]http://www.motorola.com

gatekeeper

gatekeeper
  • Members
  • 18 posts

Posted 18 March 2003 - 22:19

Thank you guys,
The code works. What I did was made a function which takes the icon file name as its parameter and got the job done.
Code Sample

function SetControlPanelDisplayIcon(sIco)
STRING DestString;
begin
      if (sIco != "") then
           DestString = TARGETDIR;
           StrRemoveLastSlash(DestString);
           sIco = DestString + "\\" + sIco;

          DestString= "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + PRODUCT_GUID;
            RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
            RegDBSetKeyValueEx (DestString , "DisplayIcon" , REGDB_STRING_EXPAND, sIco, -1);  
      endif;
end;


Pretty much this takes care of the reusability that Gonzales is talking about

Thank you everyone for your help.