Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Create Shortcuts/Get Desktop Folder
Message
 
 
To
14/01/2004 12:54:34
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00866766
Message ID:
01544075
Views:
52
That looks great, Fernando! I'll give it a try and update results here...



>Hi Bob,
>
>Just adding to what our fellows told, I use this procedure when wanting to create shortcuts.
>
>Hope it helps.
>
>Fernando
>
> Procedure CreateShortcut (pShortcutName, pTargetPath, pParameters, pWorkingDir, pIconLoc, pDescription)
>*--------- --------------
>
>* Example:
>*
>* cShortcutName = "C:\Temp\Teste"                              - Where Shortcut will be placed
>* cTargetPath   = "C:\Pointer\FoxProgs\Acessos\acessosusr.exe" - Program to be executed
>* cParameters   = "'Action=Request UserId=Pointer WhoAmI=RU'"  - Parameters (optional)
>* cWorkingDir   = "C:\Pointer\FoxProgs\Acessos"                - Working directory for executing program
>* cIconLoc      = "C:\Pointer\FoxProgs\Acessos\acessosusr.exe" - Shortcut Icon location
>* cDescription  = "Autorização de Solicitação de Acessos"      - Comments
>
> Local cShortcutName, cTargetPath, cParameters, cIconLoc, cDescription
> Local WshShell     , oShellLink
>
> cShortcutName = ForceExt (AllTrim (pShortcutName), "Lnk")
> cTargetPath   =           AllTrim (pTargetPath  )
> cParameters   =           AllTrim (pParameters  )
> cWorkingDir   =           AllTrim (pWorkingDir  )
> cIconLoc      =           AllTrim (pIconLoc     )
> cDescription  =           AllTrim (pDescription )
>
> If Empty (cWorkingDir)
>    cWorkingDir  = JustPath  (cTargetPath)
> endif
>
> If Empty (cIconLoc)
>    cIconLoc     =            cTargetPath
> endif
>
> If Empty (cDescription)
>    cDescription = JustFName (cTargetPath)
> endif
>
> oWshShell                   = CreateObject             ("Wscript.Shell")
> oShellLink                  = oWshShell.CreateShortcut ( cShortcutName )
>
> oShellLink.TargetPath       = cTargetPath
> oShellLink.Arguments        = cParameters
> oShellLink.WorkingDirectory = cWorkingDir
> oShellLink.IconLocation     = cIconLoc
> oShellLink.Description      = cDescription
>
> oShellLink.Save ()
>
> EndProc                         &&  of CreateShortcut
>
Steve Howie, owner
DaSH Technology
Denver, CO
Previous
Reply
Map
View

Click here to load this message in the networking platform