>I am using the WSH to create links for my application. The proper icon (the one associated with the app) showes up on the Desktop link but does not on the programs\koinonia link. I even tried to set the IconLocation property but no luck. By the way what are the index values. The example in the help file shows a 0 but does not explain what others there are and what they mean :(
>
The index values are the 0-indexed position in the icon list for the resource to pull the desired icon from. An icon source can have lots of different icons embedded in it (for a simple example of such, look at MORICONS.DLL, which is nothing more than an icon resource repository); it's a vector, or one-dimensional array, starting at the 0th position and working up - you can have several hundred embedded icons in a resource file as I recall; it's documented in the MSDN Library, in Appleman's VB book, and in the Win98 Developer's Guide in some detail. So not only do you need the name of the file supplying the icon, you need to specify which of the (potentially) many icons you want to reference
>Here is the code:
>
>***********************************************************************************
>*** Install the Desktop link
>***********************************************************************************
>oShell = CREATEOBJECT("WScript.Shell")
>lcApplication = lcInstallPath + "FFA.exe"
>lcDesc = "FFA Program"
>lcDeskTop = oShell.SpecialFolders("DeskTop")
>lcLnk = lcDeskTop + "\FFA Program.lnk"
>oLNKDesktop = oShell.CreateShortCut(lcLnk)
>oLNKDesktop.Description = lcDesc
>oLNKDesktop.TargetPath = lcApplication
>oLNKDesktop.WindowStyle = 3
>oLNKDesktop.WorkingDirectory = lcInstallPath
>oLNKDesktop.Save
>
>*******************************************************************************
>*** Install the Koinonia folder link
>*******************************************************************************
>oShell = CREATEOBJECT("WScript.Shell")
>lcApplication = lcInstallPath + "FFA.exe"
>lcIcon = lcApplication + ", 0"
Your problem may be here; looking in the registry, I don't see a space following the comma in the DefaultIcon registry subkey that uses the same structure. Also, the default position taken for the icon should be the 0th position of the tareget, which you're already specifying, so this shouldn't do anything. And if you're successfully creating the shortcut on the Desktop, this may seem like a silly idea, but you've got the path to the .LNK file you created on the Desktop, why not just copy the damned thing into place rather than create another instance of the same shortcut???
ie:
* I've assumed that the directory you need to copy into already exists
* otherwise, you can always test for it and use MKDIR to create it if needed
lcPrograms = oShell.SpecialFolders("Programs")
lcProgMenuLnk = lcPrograms + "\Koinonia\FFA Program.lnk"
COPY FILE (lcLnk) TO (lcProgMenuLnk)
or am I being dense here?
>lcDesc = "FFA Program"
>lcPrograms = oShell.SpecialFolders("Programs")
>lcLnk = lcPrograms + "\Koinonia\FFA Program.lnk"
>oLNKKoinonia = oShell.CreateShortCut(lcLnk)
>oLNKKoinonia.Description = lcDesc
>oLNKKoinonia.TargetPath = lcApplication
>oLNKKoinonia.WindowStyle = 3
>oLNKKoinonia.WorkingDirectory = lcInstallPath
>oLNKKoinonia.IconLocation = lcIcon
>oLNKKoinonia.Save
>
>return
>
>
>Ed you out there
>
>Thanks in advance
>Terry