Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a shortcut
Message
From
14/05/2002 16:04:12
 
 
To
08/05/2002 13:29:37
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Installation, Setup and Configuration
Miscellaneous
Thread ID:
00654108
Message ID:
00656459
Views:
22
This message has been marked as the solution to the initial question of the thread.
Emerson ,

When I need to create shortcuts, I call this simple function:
 Procedure CreateShortcut (pShortcutName, pTargetPath, pParameters, pWorkingDir, pIconLoc, pDescription)
*--------- --------------

* Parameters:
*
* cShortcutName = "C:\Temp\Teste"                                                - Name and place of the shortcut
* cTargetPath   = "C:\Pointer\FoxProgs\Acessos\acessosusr.exe"                   - Program to be executed
* cParameters   = "'Action=Request UserId=Pointer UserDomain=agcocan WhoAmI=RU'" - Parameters (optional)
* cWorkingDir   = "C:\Pointer\FoxProgs\Acessos"                                  - working directoy
* cIconLoc      = "C:\Pointer\FoxProgs\Acessos\acessosusr.exe"                   - 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
Maybe you want to give it a try...

Fernando
Previous
Reply
Map
View

Click here to load this message in the networking platform