Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WSH - shortcuts, setting properties programatically
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00742107
Message ID:
00742118
Views:
46
>The code below will create a shortcut:
>
>WshShell = Createobject("Wscript.shell")
>strDesktop = Alltrim(WshShell.SpecialFolders(tcShortCutPlacement))
>oMyShortcut = WshShell.CreateShortcut(strDesktop+"\"+tcShortCutName)
>oMyShortcut.WindowStyle = 4  && 1=normal 3=Maximized 7=Minimized  4=Normal
>oMyShortcut.IconLocation = lcSaveIconDir
>oMyShortcut.TargetPath = lcSaveTargetPath
>oMyShortcut.WorkingDirectory = lcSaveWorkingDir
>oMyShortcut.HotKey = "ALT+CTRL+F"
>oMyShortcut.Description = lcSaveDescription
>*oMyShortcut.Arguments = "C:\myFile.txt"
>
>I know the name of the shortcut determines the title you see under the icon on the screen and you can rename the 'lnk' file to change that title.
>
>1. Is there a way to name the file while creating the shortcut (different from the target name)?

The file name can be anything you like. It doesn't have to be the same as the executable.

>2. How to change other properties like 'close on exit' while creating the shortcut or programatically?

No, only the properties that Intellisense displays that are read-write are available. For example, "Close on Exit", applies only to DOS applications, and is not exposed even after the shortcut has been created and you get a reference to it with an additional CreateShortCut() command.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform