PDA

View Full Version : Help with ICON file


leebos
08-16-2005, 08:29 AM
I have an application that uses Shell.CreateShortcut to build desktop shortcuts to a number of batch files to start the application. However since I build on the C: drive if the client installs on other than the C: drive the shortcuts don't work because the "Target" points to the wrong path. The "Start in" also has to be changed.

Does anyone know how to change the .ink files properties from within AMS5 Pro to accomplish this?

Lee

TJ_Tigger
08-16-2005, 08:55 AM
I have an application that uses Shell.CreateShortcut to build desktop shortcuts to a number of batch files to start the application. However since I build on the C: drive if the client installs on other than the C: drive the shortcuts don't work because the "Target" points to the wrong path. The "Start in" also has to be changed.

Does anyone know how to change the .ink files properties from within AMS5 Pro to accomplish this?

Lee


When the user selects a different directory where they want to install your project, save that directory as a variable. Then when you create the shortcut use that variable as part of the path to the file.


--Ask where they want to run their install
strNewPath = Dialog.FolderBrowse("Select Install Folder", _ProgramFilesFolder);
--[[run your install stuff here
and here
and here]]
--Then build your shortcut using the path selected above.
Shell.CreateShortcut(Shell.GetFolder(SHF_DESKTOP), "Shortcut to My File", strNewPath.."\\AppFolder\\MyExe.exe", , , "", 0, SW_SHOWNORMAL, nil);



Tigg

leebos
08-16-2005, 09:28 AM
Tigg,

That works for a single shortcut, but not for my purpose. I have about 12 shortcuts stored in C:\application\icons. They point to C:\application\batfiles. Each batchfile calls in a different setup file and then starts the application.exe. For each of the 12 shortcuts I need to be able to change the "Target" and "Start in" locations. I don't know the batch file or shortcut names as they are created by other users. I use a File.Find to get them. I am able to change the batchfiles to work but not the .lnk files

Lee

TJ_Tigger
08-16-2005, 09:56 AM
Tigg,

That works for a single shortcut, but not for my purpose. I have about 12 shortcuts stored in C:\application\icons. They point to C:\application\batfiles. Each batchfile calls in a different setup file and then starts the application.exe. For each of the 12 shortcuts I need to be able to change the "Target" and "Start in" locations. I don't know the batch file or shortcut names as they are created by other users. I use a File.Find to get them. I am able to change the batchfiles to work but not the .lnk files

Lee


Can you not recreate the shortcuts after you find the batch files?

If not, it may require a dll call using Shell32 to change the information in an existing .lnk file. Worm or Intrigued may be able to help with their programming knowledge.

Tigg

leebos
08-16-2005, 10:39 AM
Tigg,

I could "IF" I knew the name of the original shortcut. They must remain the same.

I found a dll written by Worm that gets the Target, I may be able to use that to rebuild the shortcut.

Thanks,
Lee