cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Darain
Level 6

ALLUSERS again...

I have searched and read quite some threads in the forum regarding ALLUSERS settings, both on InstallShield and MSDN, but still doesn't know exactly what I need to do to set ALLUSERS in InstallScript.

What I need is this: I have a procedure in InstallScript to add a shortcut on the desktop and Start\AllPrograms at the end of install. So I use the following script,

[FONT="Courier New"][SIZE="2"]if (BUTTON_CHECKED = CtrlGetState(szDialogName, CHKBX_DESKTOP)) then
AddFolderIcon (DesktopFolder, "myApp", PATH_APPEXE, INSTALLDIR, PATH_ICO, 0, "", REPLACE);
endif;
if (BUTTON_CHECKED = CtrlGetState(szDialogName, CHKBX_STARTPROGRAMS)) then
AddFolderIcon (ProgramMenuFolder, "Pogo", PATH_APPEXE, INSTALLDIR, PATH_ICO, 0, "", REPLACE);
endif;
[/SIZE][/FONT]

I had checked the "Automatically create ISSetAllUsers action" checkbox under the Options -> General tab, so I supposed the shortcuts would install to the AllUsers folder under Documents&Settings when installed by an administrator and install to folder when installed by any other users. But it's not. It always installed under folder.

So I supposed that "Automatically create ISSetAllUsers action" checkbox didn't mean to set install to AllUsers as default. Then I read those postings in forums and tried adding
[FONT="Courier New"][SIZE="2"]ALLUSERS = 1;[/SIZE][/FONT]
right before the above script, but the shortcuts still did not install for all users when installed by an administrator.

Can anyone let me know where I should set the ALLUSERS variable, or do I have to use other functions?

(Oh, by the way, don't ask me why I don't use the built-in dialog for adding shortcuts. It's a company requirement. :))
Labels (1)
0 Kudos
(11) Replies
bdshan
Level 4

I think what you want is:

MsiSetProperty(
MSIHANDLE hInstall,
LPCTSTR szName,
LPCTSTR szValue
);


So it would be something like this:

MsiSetProperty(hMSI, "ALLUSERS", "1");


Or you could do a Set Property custom action, but that is probably more work and this one line of code.
0 Kudos
Darain
Level 6

I just tried [FONT="Courier New"]MsiSetProperty(ISMSI_HANDLE, "ALLUSERS", "1");[/FONT] but the shortcuts are still created in:
[FONT="Courier New"][SIZE="2"]C:\Documents and Settings\\Desktop
C:\Documents and Settings\\Start Menu\Programs
[/SIZE][/FONT]

instead of:
[FONT="Courier New"][SIZE="2"]C:\Documents and Settings\All Users\Desktop
C:\Documents and Settings\All Users\Start Menu\Programs
[/SIZE][/FONT]

Maybe...are there any additional settings I need to make for the MsiSetProperty() funtion to come into effect?
0 Kudos
bdshan
Level 4

How are your shortcuts defined? Are you using the system properties for folder names or did you hard code them?

What does you log say in regards to property values?
0 Kudos
vanyans
Level 3

Try using ProgDefGroupType(COMMON); this should set folders you need to AllUsers.
i would do do something like this just before you call your script to add icons:
If (ALLUSERS = 1 ) then
ProgDefGroupType(COMMON);
else
ProgDefGroupType(PERSONAL);
0 Kudos
Darain
Level 6

Tried. The same. Shortcuts still installed to
[FONT="Courier New"][SIZE="2"]C:\Documents and Settings\[/SIZE][/FONT]
0 Kudos
bdshan
Level 4

We maybe able to help more if you posted the code for the shortcut creation.
0 Kudos
Darain
Level 6

Here is the code again:
[FONT="Courier New"][SIZE="2"]if (BUTTON_CHECKED = CtrlGetState(szDialogName, CHKBX_DESKTOP)) then
AddFolderIcon (DesktopFolder, "MyApp", PATH_APPEXE, INSTALLDIR, PATH_ICO, 0, "", REPLACE);
endif;
[/SIZE][/FONT]

Here are what I have done - right above of these three lines of script, I tried to put:
case 1:
[FONT="Courier New"][SIZE="2"]ALLUSERS = 1;[/SIZE][/FONT]
case 2:
[FONT="Courier New"][SIZE="2"]MsiSetProperty(ISMSI_HANDLE, "ALLUSERS", "1");[/SIZE][/FONT]
case 3:
[FONT="Courier New"][SIZE="2"]MsiSetProperty(ISMSI_HANDLE, "ALLUSERS", "1");
if (ALLUSERS != 1 ) then
ProgDefGroupType(COMMON);
else
ProgDefGroupType(PERSONAL);
endif;
[/SIZE][/FONT]
case 4:
[FONT="Courier New"][SIZE="2"]MsiSetProperty(ISMSI_HANDLE, "ALLUSERS", "1");
ProgDefGroupType(COMMON);
[/SIZE][/FONT]

None of them changes the result: The shortcut always being created under the folder
[FONT="Courier New"][SIZE="2"]C:\Documents and Settings\\Desktop[/SIZE][/FONT]

Come to think of it, maybe it's the keyword DesktopFolder not doing its job. According to the documents, DesktopFolder should be dynamically pointed to either
[FONT="Courier New"][SIZE="2"]C:\Documents and Settings\All Users\Desktop[/SIZE][/FONT]
or
[FONT="Courier New"][SIZE="2"]C:\Documents and Settings\\Desktop[/SIZE][/FONT]
depending on whether ALLUSERS is set to 0 or 1. But in my case, it never changes.

Any more ideas that I can try are appreciated. Thanks.
0 Kudos
vanyans
Level 3

What is the type of project that you are using. I understood its InstallScript, and it seems you are mixing it with MSI properties.
If its pure InstallScript you should be using FOLDER_DESKTOP and ProgDefGroupType(COMMON);
This combination works for me.
Good Luck!
0 Kudos
Darain
Level 6

Oooh, I am using InstallScript MSI...
Any solution for this particular type?

It could be that I have to change the ALLUSERS setting in some MSI property table or something, instead of in InstallScript then. I read some post earlier that I could change ALLUSERS in the Property Manager table, but I could find any entry related.
0 Kudos
Darain
Level 6

tada...finally...

It turned out the problem really lies in the variable DesktopFolder. I thought FOLDER_DESKTOP was deprecated so I used DesktopFolder instead...which brought me all the troubles. Looks like InstallShield doesn't update the value of the DesktopFolder after its initiation.

Thank you guys for the inspiration and tips!
0 Kudos
Michael0815
Level 2

Sorry for bringing up this old thread...but I have the same problem with Installshield 2011. I set the ALLUSERS property in the customer information dialog but the DESKTOPFOLDER variable doesn't change. I have a Basic MSI project. If I change the ALLUSERS property right from the start, my files are copied to '\Desktop' or 'All Users\Desktop'. But not when ALLUSERS is changed via the UI dialog. Can anybody help me?
0 Kudos