Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to extract file info from windows shortcut (.LNK file)
Message
De
06/05/2006 08:32:29
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
How to extract file info from windows shortcut (.LNK file)
Divers
Thread ID:
01119858
Message ID:
01119858
Vues:
268
In an application that handles several hundred thousands of image files (especially JPGs) the need to eliminate doubling of image-data got me to consider windows shortcut files as a way of pointing to an image file from different directories.

In VFP I can create those links using the windows scripting host along the lines of the following function:

LPARAMETERS lcDestinationPath, lcDestinationFilename, lcShortcutTarget
LOCAL oWsh

* add Backspace just in case
lcDestinationPath = ADDBS(lcDestinationPath )

* get reference to the Windows Scripting Host
* (if installed on the system – may not always be the case)
oWsh = CREATEOBJECT("wscript.shell")

* path and filename for the short-cut file
oShort = oWsh.CreateShortcut(lcDestinationPath + ; lcDestinationFilename+".LNK")

* die Datei, zu der der Shortcut führen soll ist lcShortcutTarget

* Target path setzen in den WSH object
oShort.TargetPath = lcShortcutTarget

* das ganze abspeichern wie oben definiert
oShort.Save

RELEASE pWsh

Since I would like to also traverse a directory of LNK-files and show the pictures referred to I need to set the picture-property of my image control the target of the link (to not the link itself), for example:

The link file in a directory:

"PIC_T033327.JPG.LNK.LNK"

The target of this link file:

"H:\WEB_SCHWANGER_KOPIEN\001_ANDREABROUWER_000891\PROOFS_BW_AL\PIC_T033364.JPG"

Interestingly enough, when I use the VFP getfile() function and pick one of those linkfiles, GETFILE() resolves the link file and extracts the path to the JPG (the target of the link file). Unfortunately adir() does not and doesn’t seem to have parameters to do so.

When I look at the content of the LNK-file, it is obvious, that the Drive, path, filename etc. are contained therein, but is there a good or simple way to read out the exact info?

Does anyone know were to find the file structure or documentation about these shortcut files?

Maybe there is a windows scripting host approach or an api call of sorts?

Any help would be greatly appreciated.

Teddy Billewicz – Heidelberg, GERMANY
Teddy Billewicz - MyViewFotoArt
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform