This content is provided AS IS for archive purposes only. Content may be out of date with no guarantee of correctness.

CreateShortcut - Lnk for Cobra - Static

Main Article

CreateShortcut - Lnk for Cobra

Function CreateShortcut(lnkpath:String, volume: Integer, volume_type: Integer) : ^lnks

lnkpath: The path to a shortcut file to create. If the file extension ".lnk" is not included, it will be appended automatically

volume: The volume that the lnk file will be created on (currently, only LNK_VOLUME_LOCAL is valid).

volume_type: The type of volume that the lnk file will be created on (e.g. LNK_VOLUME_TYPE_FIXED) - see Exported Constants, section lVolumeType.

Creates and returns a handle for a new shortcut. Use WriteShortcut to write this shortcut to disk.

Example:

Program
  Uses

      lnk

Begin
   lnk = CreateShortcut("My Shortcut", LNK_VOLUME_LOCAL, LNK_VOLUME_TYPE_FIXED)
       lnk.lDescription = "Here's my test shortcut!!!"
       lnk.lTargetPath = CurrentDir + "\testlnk.exe"
       lnk.lRelativePath = ".\testlnk.exe"
       lnk.lWorkingDir = CurrentDir
       lnk.lCustomIcon = CurrentDir + "\test.ico"
       If WriteShortcut(lnk) = FALSE then MessageBox("Couldn't create shortcut")
   
   Free(lnk)
End

Stay Subscribed

Follow me on twitter @golightlyb, subscribe to the RSS feed or get updates by e-mail.

You can also contact me directly - I make an effort to reply to every e-mail.


Login
v0.34.archive