Previous Topic: CreateGroup - Create a New Group or Activate an Existing GroupNext Topic: DeleteGroup - Delete a Group


CreateLink - Create a Shortcut

Valid on Windows only

The CreateLink function creates a shortcut to a file.

Default Format
CreateLink(Title as string, FileName as string, Arguments as string, WorkDir as string, Group as string, IconFile as string, Style as Integer, Offset as Integer) as Boolean.
Other Formats
CreateLink(Title as string, Filename as string, Arguments as string, Workdir as string, Group as string) as Boolean

as main format but with iconfile = "", style = LNK_NORMAL, and offset = LNK_PROGRAMS.

CreateLink(Title as string, Filename as string, Arguments as string, Workdir as string,Group as string, Iconfile as string) as Boolean

as the main format but with style = LNK_NORMAL and offset = LNK_PROGRAMS.

CreateLink(Title as string, Filename as string, Arguments as string, Workdir as string, Group as string, Style as integer) as Boolean

as the main format with iconfile = "" and offset = LNK_PROGRAMS.

CreateLink(Title as string, Filename as string, Arguments as string, Workdir as string, Group as string, Style as integer, Offset as integer) as Boolean

which is the same as the main format with iconfile = "".

CreateLink(Title as string, Filename as string, Arguments as string, Workdir as string, Group as string, Iconfile as string, Style as integer) as Boolean

as the main format but with offset = LNK_PROGRAMS. For software delivery style compatibility, TRUE is mapped to LNK_MINIMIZE and FALSE to LNK_NORMAL.

CreateLink(Title as string, Filename as string, Arguments as string, Workdir as string, Group as string, Iconfile as string, Iconindex as integer, Style as integer, Offset as integer, Hotkey as word, Description as string) as Boolean

Hotkey consists of two parts, the virtual-key code in the low-order byte and the modifier flag in the high-order byte. For the modifier flag, the following constants are defined:

HOTKEYF_ALT

Alt key

HOTKEYF_CONTROL

Ctrl key

HOTKEYF_EXT

Extended key

HOTKEYF_SHIFT

Shift key

To define a hotkey Ctrl+Alt+X you can code

Dim HOTKEYF as Word
hotKey = HHOTKEYF_ALT + HOTKEYF_CONTROL + asc("X")
Title

Specifies the title of the shortcut.

FileName

Specifies the path and name of the file to which the shortcut refers. As a minimum, this parameter must be the name of the file.

Arguments

Specifies optional arguments or switches to the file.

WorkDir

Specifies the name of the default (or working) directory.

Group

Identifies the group (or folder) to add the shortcut to. If this parameter is an empty string, the value of the Offset parameter determines where the shortcut is placed.

IconFile

Identifies the file name for the icon to be displayed in the group window. This file can be an executable file or an icon file. If this parameter is an empty string or omitted, the first icon in the file specified by FileName is used.

Style

Specifies how the file appears when the shortcut is activated. Use one of the following constants.

LNK_NORMAL

Runs as normal.

LNK_MAXIMIZE

Runs as maximized.

LNK_MINIMIZE

Runs as minimized. If Style is not specified, the value LNK_NORMAL is used.

Offset

Specifies the relative location of the Group argument. Use one of the following constants.

LNK_PROGRAMS

Places the item in the Programs group.

LNK_DESKTOP

Places the item on the Desktop.

LNK_STARTMENU

Places the item in the Start menu.

LNK_STARTUP

Places the item in the Startup group.

LNK_ABSOLUTE

Places the item in the specified directory.

Iconindex

Specifies the index of the icon to show. If iconindex is not coded, the first icon in the icon list is chosen.

Hotkey

Specifies hotkey code for the icon. If 0 is coded, no hotkey is set.

Description

Identifies transparent information stored in the shortcut.

On successful completion, the function returns TRUE; otherwise, returns FALSE. When running in the DOS environment, the command is placed in a queue to run on Windows startup. For this reason, the return value is always TRUE.