Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Create Shortcuts/Get Desktop Folder
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00866766
Message ID:
00866793
Vues:
26
>>>>Does any one know how to create a windows shortcut programatically?
>>>>
>>>>And along with that determine the Desktop folder to save it into?
>>>>
>>>
>>>For only Win2k or + you can:
>>>
>>>
>>>
>>>DECLARE INTEGER CreateShellLink IN LNKFILES.DLL;
>>>STRING @lpzLinkFileName, STRING @lpzExeFileName
>>>
>>>
>>>oShell = CREATEOBJECT("WScript.Shell")
>>>oFso = CreateObject("Scripting.FileSystemObject")
>>>cwdesktopfolder = oShell.SpecialFolders("Desktop")
>>>
>>>
>>>lnErrorCode = CreateShellLink(cwdesktopfolder+"\My Shortcut.lnk","c:\myfolder\myapp.exe")
>>>
>>
>>That's a DLL that I wrote. Its intended target platform was Win9x, so there was some limited functionality. For example, can't get the All User's Desktop.
>George
>
>
>In that case, the better option is to mix the two solution (franco and mine), something as:
>
>
>oShell          = CREATEOBJECT("WScript.Shell")
>oFso            = CreateObject("Scripting.FileSystemObject")
>cwdesktopfolder = oShell.SpecialFolders("Desktop")
>
>lnk             = oshell.CreateShortcut("foo.lnk")
>lnk.TargetPath  = "c:\dummy.exe"
>lnk.Save
>
>
Claudio,

Well, the DLL does still work under Win2x. I'd recommend, however, using it only on platforms where the WSH isn't available.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform