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

Refreshing the Desktop after uninstall


3 replies to this topic

jonathan2002

jonathan2002
  • Members
  • 44 posts

Posted 06 April 2004 - 09:46

I have an installation for a product that adds a file converter to MS Word. Part of the functionality of the product is that any files saved in the special format it applies, have a new file extension we have defined, and appear with a special icon. When the product is uninstalled, the data relating to the extension and its icon are deleted from the registry.

My problem is that if the user has saved any of our formatted files to their desktop, then the icons are not refreshed immediately after uninstallation. They continue to show our custom icons even thogh that file class has been removed, adn Windows no longer knows which application to use in opening those files. If Windows is restarted the problem goes away, but that is not an acceptable solution. What I want is for the icons to disappear when the extension is uninstalled.

I have added code to locate and delete the ShellIconCache file, but that does not have immediate effect. I have also tried using FindFile to access the Desktop folder in memory to try Renaming the files, but such moves are useless as what is needed is for the *view* of the Desktop to be refreshed.

It must be possible to do that since Desktop Shortcuts appear/disappear if they are part of an installation. How can I force the Desktop to refresh after I remove this file extension?

I am using a Basic MSI project.

jonathan2002

jonathan2002
  • Members
  • 44 posts

Posted 06 April 2004 - 12:32

Since I posted this, I have devised a quick'n'dirty fix that involves using a calling small exe written in C++ that detects all processes of Explorer and terminates them, then starts up 1 new one, thus scrapping the desktop and then creating it afresh. This will do for now, but if anyone knows of a better way of doing it in InstallScript I'll happily rewrite.

I tried detecting Explorer by using FindWindow with the result of QueryShell, but got a null handle back.

luke_s

luke_s
  • Full Members
  • 532 posts

Posted 07 April 2004 - 08:33

Try using -
SHGetFolderLocation(....)
Gets the desktop location and item id
then
SHChangeNotify(SHCNE_ALLEVENTS, SHCNF_IDLIST, lpitemidlist, 0)
to notify the item to change events


hteichert

hteichert
  • Members
  • 158 posts

Posted 07 April 2004 - 15:16

Further on it's a really bad idea to kick out all processes of Explorer. Some of the processes in the taskbar will get lost and not reappear in the new one - you will loose the possibility to access them until the next logoff/logon. Some of them will even get lost until the next reboot.
h.teichert-ott