IShellLink v1.4


by Martin Stachon
email : martin.stachon@tiscali.cz
web : http://www.webpark.cz/stachon/

Library for creating a link (shortcut) and resolving its information. (using IShellLink interface via EuCOM)

Feel free to use, modify and distribute (No warranty for not causing system crashes, overwriting your files, teleporting your computer to another dimension etc. You know ;)



Usage


Version 1.4 changed the interface !

LINK structure

LINK link
link = new_link()

The LINK structure is used to pass link information to create_link() and resolve_link() returns this structure as well. LINK fields are :

LINK_path        : path of the link file (*.lnk)
LINK_links_to    : path the link points to
LINK_description : description (appears in newer explorer versions)
LINK_arguments   : command line arguments
LINK_hotkey      : virtual keycode for hotkey
LINK_icon_path   : path to icon file
LINK_icon_id     : icon id (inside the icon file)
LINK_show_cmd    : initial state of the window (SW_MINIMIZE, SW_MAXIMIZE, SW_SHOW...)
LINK_working_dir : working directory

Initially, all fields are set to {-1}

Creating a link

include CreateLink.ew
i = create_link(LINK link )

link is LINK structure, filled with information about the link you want to create. Fields with value {-1} are considered empty.

Return value is either 0 (false) which means that an error happend and shortcut was not created or 1 (true) = shortcut was created successfully

Resolving a link

include CreateLink.ew
link = resolve_link(file)
   sequence file : path to a link (.lnk) file to resolve

Returns LINK structure with fields set.


History


v1.4  :  - new interface, allow obtaining more info about link (suggested by Aku)
v1.3  :  - added resolve_link() (requested by Rufi)
         - add parameters for icon and hotkey
v1.2  :  - encuragued by recieving my first 
           Micro-Economy money :) Thanks !
         - corrected typos, cleanup, readme.txt
v1.1  :  - CreateLink -> create_link
         - win32lib mem routines replaced
           with Eu's native
         - added error checking
         - returns 0 if an error, 1 if succeeded
         - added parameter for command-line args
v1.0  :  - First release

Thanks


Thanks to Matt Lewis for pointing out wrong IShellLink Interface Methods definitions, and, of course, for his excellent library EuCOM. Also to Rufi and Aku for suggestions