Solved

How to refresh the WINDOWS desktop calling API-functions ?

Posted on 1998-07-11
7
1,850 Views
Last Modified: 2013-11-19
I have written an installation program with InstallShield 5.1. While deinstallation I call a custom-dll that deletes some files
that couldn't automatically deleted by unInstallShield. I have some shortcuts in WINDOWS start menu installed. After deinstallation I
can check with Explorer, that these .LNK-files in the subfolder of the start menu are deleted, but they are still displayed in
Windows 95 start menu, because Windows keeps all the desktop symbols and start menu in cache. I asked this question also
at InstallShield, but didn't got any good answer for it. I could call while deinstallation any API-functions from my
custom-deinstallation-DLL, that could refresh the start menu and the desktop symbols.

I need a way how to do it !
0
Comment
Question by:atari
7 Comments
 
LVL 1

Expert Comment

by:chacko
ID: 1319050
InstallShield provides functions to add/delete folders/icons/shortcuts. R u using free edition/professional edition? Professional edition has. If can not There are SDK functions to add/delete folders/icons...
0
 
LVL 1

Author Comment

by:atari
ID: 1319051
This was not the question. I asked, how I can refresh the Windows startmenu entries and the Windows desktop after deinstallation. The problem is, that Windows hold all the startmenu entries and desktop symbols in cache and after deinstallation of my program the startmenu entries are still there and are updated only after rebooting of the system. That's a known problem for Installshield, but they have no solution how to refresh the start menu entries after deinstallation with unInstallShield. But I have seen a program, called 'TuneUp 97' that has an option to read the desktop symbols and the startmenu entries in Windows cache again. Afterwards my startmenu entries are correctly deleted. So there must be a way, to program this option with API-functions in VC++, to call it from my custom-deinstallation-DLL, that will be called after deinstallation with unInstallShield..
For your information: I'm using InstallShield 5.1 (newest available version.).
0
 
LVL 3

Expert Comment

by:tma050898
ID: 1319052
Does this happen on NT as well?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 4

Accepted Solution

by:
piano_boxer earned 200 total points
ID: 1319053
I did a little 'reversed engenering' on TweakUI (PowerToys) and the only relevant functions I could find is this:

#include <shlobj.h>

// Refresh start-menu
LPITEMIDLIST lpil;
HWND hwnd = <Handle of your window>!
SHGetSpecialFolderLocation(hwnd, CSIDL_STARTMENU, &lpil);
SHChangeNotify( SHCNE_ALLEVENTS, SHCNF_IDLIST, lpil, NULL);

// Refresh desktop
SHGetSpecialFolderLocation(hwnd, CSIDL_DESKTOPDIRECTORY, &lpil);
SHChangeNotify( SHCNE_ALLEVENTS, SHCNF_IDLIST, lpil, NULL);


For information about flags that you can pass to these functions, look in the file 'shlobj.h'. The docs are not very informative about these functions.
0
 
LVL 1

Author Comment

by:atari
ID: 1319054
Answer to tma:
I have searched all the newsgroup of installshield.com and what was very nice, that also an installshield-engineer thought first, that it was a bug of InstallShield 5.1, that the start menu not always is refreshed, and he said, that in the next version of InstallShield this bug will be updated. One day later he wrote, that InstallShield and unInstallShield are both working correct, but the start menu entries are kept in cache and first after rebooting or again reading the cache again the startmenu .LNK-files will be refreshed. That was very funny, when I wrote this. The installshield engineer said, that it happens also on Windows95/NT and very surprisingly also on Windows 98. Sometimes the refresh is working correctly if you have a subfolder in startmenu-folder and you delete the whole folder after deinstallation. But if you have a multiple application installation, say you have a subfolder in startmenu-folder, that includes several links for deinstallation, called 'Deinstall program 1', 'Deinstall program 2' and so on, then after uninstalling only one of this program, say program 1, then the .LNK-file is correctly deleted, but in startmenu the entry 'Deinstall program 1' is still there.

This is only a comment.
Piano_boxer (nice name), nice answer, but seems very hard to implement, ok, I will try it, yes, I forgot Tweak UI, it's only hard to test, because I must install programs first and then uninstall it, and then my uninstall.dll will be called with the functions above.

Give me one or two days !
Bye,
atari
0
 
LVL 1

Author Comment

by:atari
ID: 1319055
Great, everything works fine, the startmenu entries after calling SHChangeNotify( SHCNE_ALLEVENTS, SHCNF_IDLIST, lpil, NULL);  are now refreshed after deinstallation with unInstallShield.

Excellent answer, I am very surprised, that it works so fine.

Bye,
atari
0
 
LVL 4

Expert Comment

by:piano_boxer
ID: 1319056
Great, I'm happy that it worked (I was unable to verify it 100% my self).
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Rewrite URL With Encoded Characters 6 78
substring method in java 1 116
string initialization in java 11 113
Hibernate methods 2 71
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now