This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- How to solve All Users desktop loation on W2K and later?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 07, 2008
03:58 PM
How to solve All Users desktop loation on W2K and later?
Hi,
I am troubleshooting a shortcut problem, and want to delete a .lnk file from allusers desktop folder.
The location in W2K and XP is at C:\Documents and Settings\All Users\Desktop (I am assuming W2K3 will be the same), but on Vista, it's Desktop\Public\Public Desktop . I would like to call 'del' to delete the .lnk file during uninstall, how can I relsove (property/reg key/etc.) the location in my IS Script file?
Thanks,
Peter
I am troubleshooting a shortcut problem, and want to delete a .lnk file from allusers desktop folder.
The location in W2K and XP is at C:\Documents and Settings\All Users\Desktop (I am assuming W2K3 will be the same), but on Vista, it's Desktop\Public\Public Desktop . I would like to call 'del' to delete the .lnk file during uninstall, how can I relsove (property/reg key/etc.) the location in my IS Script file?
Thanks,
Peter
(7) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 07, 2008
05:24 PM
Assuming a per-machine installation, would FOLDER_DESKTOP or DesktopFolder have the value you want?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2008
12:14 PM
Hi Robert,
Thank you for your reply.
Unfortunately neither of the properties you provided works for me. I insert a bunch of properties into my code and see what they return, and only 'StartupFolder' returned something, not exactly what I wanted though, I have to process it and make up a 'Desktop' folder. Here is the list I tried in my script (please note that I am using InstallScript MSI, not Basic MSI):
CSIDL_COMMON_DESKTOPDIRECTORY
FOLDERID_PublicDesktop
ALLUSERSPROFILE
FOLDER_COMMON_APPDATA
StartMenuFolder
StartupFolder
FOLDER_DESKTOP
DesktopFolder
Testing code is:
MsiGetProperty(ISMSI_HANDLE ,"CSIDL_COMMON_DESKTOPDIRECTORY",sDir,nvSize); MessageBox("CSIDL_COMMON_DESKTOPDIRECTORY is " + sDir, INFORMATION);
Another strange thing I found is that if I put another call of 'StartupFolder' after the first one, the second one returns nothing (empty). Is this normal? I am suprised though. I also noticed that I put the same code to other places, they show different results, eg. the above code in inside OnMaintUIBefore(), if I put the code in OnBegin(), 'StartupFolder' returned empty.
I emphasized it's IS MSI project because I didn't notice the strange behaviors on Basic MSI before.
P.S. Is there a MSI or IS property for "%systemfolder%\Documents and Settings" directory, maybe I can use it to build up my 'desktop' folder, since I feel 'StartupFolder' is not that stable.
Thanks,
Peter
Thank you for your reply.
Unfortunately neither of the properties you provided works for me. I insert a bunch of properties into my code and see what they return, and only 'StartupFolder' returned something, not exactly what I wanted though, I have to process it and make up a 'Desktop' folder. Here is the list I tried in my script (please note that I am using InstallScript MSI, not Basic MSI):
CSIDL_COMMON_DESKTOPDIRECTORY
FOLDERID_PublicDesktop
ALLUSERSPROFILE
FOLDER_COMMON_APPDATA
StartMenuFolder
StartupFolder
FOLDER_DESKTOP
DesktopFolder
Testing code is:
MsiGetProperty(ISMSI_HANDLE ,"CSIDL_COMMON_DESKTOPDIRECTORY",sDir,nvSize); MessageBox("CSIDL_COMMON_DESKTOPDIRECTORY is " + sDir, INFORMATION);
Another strange thing I found is that if I put another call of 'StartupFolder' after the first one, the second one returns nothing (empty). Is this normal? I am suprised though. I also noticed that I put the same code to other places, they show different results, eg. the above code in inside OnMaintUIBefore(), if I put the code in OnBegin(), 'StartupFolder' returned empty.
I emphasized it's IS MSI project because I didn't notice the strange behaviors on Basic MSI before.
P.S. Is there a MSI or IS property for "%systemfolder%\Documents and Settings" directory, maybe I can use it to build up my 'desktop' folder, since I feel 'StartupFolder' is not that stable.
Thanks,
Peter
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2008
12:19 PM
Forget to mention that I did set 'ALLUSERS' property to '1' in the project and my testing target systems include W2K/XP/W2K3, I need to handle Vista differently.
Here is the description about 'DesktopFolder' from IS2008:
DesktopFolder
This property is used to hold the full path to the Desktop folder for the current user. If the setup is being run under Windows NT 4 or Windows 2000 for All Users, and the ALLUSERS property is set, then the DesktopFolder property should hold the full path to the All Users desktop folder.
Here is the description about 'DesktopFolder' from IS2008:
DesktopFolder
This property is used to hold the full path to the Desktop folder for the current user. If the setup is being run under Windows NT 4 or Windows 2000 for All Users, and the ALLUSERS property is set, then the DesktopFolder property should hold the full path to the All Users desktop folder.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2008
12:25 PM
In general, you'll want to set the buffer-size argument (nvSize in your example) to a large enough number to hold the returned value before calling MsiGetProperty. That is, add a line like this:
nvSize = MAX_PATH + 1;
before each call to MsiGetProperty.
Please see the MSI help and InstallShield help for explanations of those names you're using: FOLDER_DESKTOP and FOLDER_COMMON_APPDATA are InstallScript variables, which you can use directly without going through MsiGetProperty; while DesktopFolder, StartupFolder, and StartMenuFolder can be used in MsiGetProperty. (Some of them might also work as a raw variable in an InstallScript MSI project.) The CSIDL_ value is an argument to a Windows API function, so it presumably wouldn't work as a raw variable or in MsiGetProperty.
nvSize = MAX_PATH + 1;
before each call to MsiGetProperty.
Please see the MSI help and InstallShield help for explanations of those names you're using: FOLDER_DESKTOP and FOLDER_COMMON_APPDATA are InstallScript variables, which you can use directly without going through MsiGetProperty; while DesktopFolder, StartupFolder, and StartMenuFolder can be used in MsiGetProperty. (Some of them might also work as a raw variable in an InstallScript MSI project.) The CSIDL_ value is an argument to a Windows API function, so it presumably wouldn't work as a raw variable or in MsiGetProperty.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2008
02:07 PM
Robert,
Thank you so much for your helpful suggestions, now the following properties work:
ALLUSERSPROFILE
StartMenuFolder
StartupFolder
DesktopFolder
That's good enough for me.
But I got error in DeleteFile() call, the file path passed in is correct and I also used LongPathToQuote(szFile,TRUE) before DeleteFile(szFile). FormatMessage(nErr) returns "The system cannot openthe file", but I can issue 'del' command and delete the file while the error message shows on. The file is a .lnk file for desktop shortcut (C:\Documents and Settings\All Users\Desktop\File Name.lnk), without removing the file, the shortcut icon is left on desktop after uninstallation.
I also checked that it's not 'read-only' at uninstallation.
Any suggestion on it?
Thanks,
Peter
Thank you so much for your helpful suggestions, now the following properties work:
ALLUSERSPROFILE
StartMenuFolder
StartupFolder
DesktopFolder
That's good enough for me.
But I got error in DeleteFile() call, the file path passed in is correct and I also used LongPathToQuote(szFile,TRUE) before DeleteFile(szFile). FormatMessage(nErr) returns "The system cannot openthe file", but I can issue 'del' command and delete the file while the error message shows on. The file is a .lnk file for desktop shortcut (C:\Documents and Settings\All Users\Desktop\File Name.lnk), without removing the file, the shortcut icon is left on desktop after uninstallation.
I also checked that it's not 'read-only' at uninstallation.
Any suggestion on it?
Thanks,
Peter
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2008
04:05 PM
You can ignore it, but you are welcome to reply if you do have suggestion/solution.
I now make it work by puting entry in RemoveFile table. It worked on W2K, but I need to test it on Vista.
Thanks,
Peter
I now make it work by puting entry in RemoveFile table. It worked on W2K, but I need to test it on Vista.
Thanks,
Peter
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 08, 2008
06:39 PM
It works on Vista, but not perfectly -
The icon actually is deleted but still visible on the desktop, reboot will clear it out from the desktop though. Without reboot, it even can't be deleted manually, I got 'Item Not Found' erorr with message "Could not find this itm - This is no longer located in C:\Users\Public\Public Desktop. Verify the item's location and try again" (see the attached screenshot). Once I restart the system, the icon is gone.
It will be perfect if the icon is gone from desktop after installation, anybody get any idea?
Thanks,
Peter
The icon actually is deleted but still visible on the desktop, reboot will clear it out from the desktop though. Without reboot, it even can't be deleted manually, I got 'Item Not Found' erorr with message "Could not find this itm - This is no longer located in C:\Users\Public\Public Desktop. Verify the item's location and try again" (see the attached screenshot). Once I restart the system, the icon is gone.
It will be perfect if the icon is gone from desktop after installation, anybody get any idea?
Thanks,
Peter