Icon Cache - Advanced Installer Community
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Icon Cache

Hello,

I’m running into the following issue…

I install my product and choose not to create desktop or start menu shortcuts. After installation, files that are associated with my program (file types specific to my program) are not showing their icon (you just see the generic plain white icon). If I run ie4uinit –ClearIconCache (Windows 7) after installation, the icons show up. However, if I choose to install either the desktop or start menu shortcuts, the file icons show up just fine.

So, it appears the icon cache might not be updating when I don’t install the desktop and start menu shortcuts.

My best guess as to what is happening – when I don’t create a desktop or start menu shortcut, windows installer (or Advanced Installer) determines that there is no reason to update the icon cache, since no shortcuts were created.

It appears I might be able to get around this by running one of the following commands in a custom action:
• [ie4uinit –ClearIconCache] or [ie4uinit –Show]
• SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL)

But, I just wanted to check if you guys had any additional information. Is this expected? Is there a good work around for this? Note that I make the file type associations for my program by registering files (regsvr32). I do not use the Advanced Installer “File Associations” functionality.


Thanks.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Icon Cache

Hello,

I'm afraid I cannot say why the extension icon is not correctly identified. I can confirm that there are few reported Windows Installer bug in what regards the shortcut icon caches, but I didn't remember facing the behavior you are reporting.

Can you try to manually register your file type associations (outside of the installation process) and see if you got different results?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Re: Icon Cache

Can you try to manually register your file type associations (outside of the installation process) and see if you got different results?
Adding the file associations to the registry after installation does not appear to fix the problem. I ended up just adding a SHChangeNotify call to one of my custom actions. That seemed to do the trick, and it was only a few lines of code. For anyone else that might run into this issue, you can use the following code:

Code: Select all

[System.Runtime.InteropServices.DllImport("Shell32.dll")]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);

SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);
In my project, I call this in a deferred custom action (without impersonation) that is executed after the "RegisterComPlus" action. I'm sure you can move the SHChangeNotify call, as long as it occurs after the files/registry entries/etc. are installed. Actually, it's probably best to run it after "Add Resources".

Anyways, thanks for the help!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Icon Cache

You're welcome.

Thank you for your follow up. Certainly your solution will be useful for future users. I added it in my records.

Have a nice day,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”