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
- :
- Re: AddFolderIcon Trouble!
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
‎Sep 20, 2010
04:25 PM
AddFolderIcon Trouble!
Hi everyone,
I am trying to write some installscript code to add a shortcut to the startup of the Technician account only. So i am getting the shortcut added just fine, the problem is the correct path is not being created to the actual program. here is what i have so far, but i must be messing up one of the values because it seems like i have tried every combination of ways to put the correct path to the program in there but it is not working, and is not launching the program since the path is incorrect.
szProgramFolder = "C:\\Users\\Technician\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup";
szItemName = "ShortcutName"; //different than name of .exe
szCommandLine = "C:\\Program Files\\ProgramToLaunch.exe";
szWorkingDir = "";
szIconPath = "";
nIcon = 0;
szShortCutKey = "";
nFlag = NULL;
nResult = AddFolderIcon ( szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag );
if(nResult < 0) then
MessageBox("Shortcut NOT Added for Technician account", SEVERE);
else
MessageBox("Shortcut Successfully Added for Technician account", INFORMATION);
endif;
Any help is greatly appreciated!
if you can see where i have gone wrong and what is causing the path to the executable to show up incorrectly please let me know
(i have looked at many examples and help files, but somehow am still not getting it!)
thanks!
Alicia
I am trying to write some installscript code to add a shortcut to the startup of the Technician account only. So i am getting the shortcut added just fine, the problem is the correct path is not being created to the actual program. here is what i have so far, but i must be messing up one of the values because it seems like i have tried every combination of ways to put the correct path to the program in there but it is not working, and is not launching the program since the path is incorrect.
szProgramFolder = "C:\\Users\\Technician\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup";
szItemName = "ShortcutName"; //different than name of .exe
szCommandLine = "C:\\Program Files\\ProgramToLaunch.exe";
szWorkingDir = "";
szIconPath = "";
nIcon = 0;
szShortCutKey = "";
nFlag = NULL;
nResult = AddFolderIcon ( szProgramFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag );
if(nResult < 0) then
MessageBox("Shortcut NOT Added for Technician account", SEVERE);
else
MessageBox("Shortcut Successfully Added for Technician account", INFORMATION);
endif;
Any help is greatly appreciated!
if you can see where i have gone wrong and what is causing the path to the executable to show up incorrectly please let me know
(i have looked at many examples and help files, but somehow am still not getting it!)
thanks!
Alicia
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2010
08:46 AM
In the shortcut's properties, what does the target look like?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2010
11:30 AM
Finally was able to figure it out, what i needed to do was have the szCommandLine as a LongPathToQuote, but not the szProgramFolder.
I am still not sure why it didnt want both of them as LongPathToQuote, but after many trials and errors it seems that using LongPathToQuote for the szCommandLine will place the correct path for the shortcut and it finds the executable.
the thing is i did change the szCommandLine from "C:\Program Files\ProgramToLaunch.exe" to PROGRAMFILES^"\\ProgramToLaunch.exe"
and then sent that value (szCommandLine) to the LongPathToQuote function, and for some reason this works just how i need it to .... i dont think i tried it before when it was "C:\Program Files\ProgramToLaunch.exe" so it is possible it would have worked this way too.
Anyway thanks for the response, it was one of those things where i was changing so many things, finally got it to work and dont really know why it does now lol. i should go back and try it as "C:\Program Files\ProgramToLaunch.exe" just to see if that would have worked also.
Not sure why i wasnt able to use 2 LongPathToQuote functions before then calling the AddFolderIcon function. But when i reduced it down to one LongPathToQuote call it worked.
I am still not sure why it didnt want both of them as LongPathToQuote, but after many trials and errors it seems that using LongPathToQuote for the szCommandLine will place the correct path for the shortcut and it finds the executable.
the thing is i did change the szCommandLine from "C:\Program Files\ProgramToLaunch.exe" to PROGRAMFILES^"\\ProgramToLaunch.exe"
and then sent that value (szCommandLine) to the LongPathToQuote function, and for some reason this works just how i need it to .... i dont think i tried it before when it was "C:\Program Files\ProgramToLaunch.exe" so it is possible it would have worked this way too.
Anyway thanks for the response, it was one of those things where i was changing so many things, finally got it to work and dont really know why it does now lol. i should go back and try it as "C:\Program Files\ProgramToLaunch.exe" just to see if that would have worked also.
Not sure why i wasnt able to use 2 LongPathToQuote functions before then calling the AddFolderIcon function. But when i reduced it down to one LongPathToQuote call it worked.
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)