The shortcut object can be used to create or delete shortcuts.
Properties | Description |
Arguments | Command line arguments for the program which the shortcut points to. |
Description | Description for the shortcut (will be shown as a tooltip) |
ExeFile | File to which the shortcut should be created |
IconFile | File that contains the icon |
IconIndex | Index that identifies the icon in a file that contains multiple icons. (zero based, index 0 = first icon) |
LnkFile | Filename of the shortcut to be created. |
ResultCode | Result of the operation, returned by the functions |
ShowCmd | Specifies how the initial window should be shown |
WorkDir
|
Pathname in which the program should be started.
|
Methods | Description |
CreateShortcut
|
Create or update a shortcut. The function returns a Boolean value. (True if successful) Function CreateShortcut(LnkFile As String, ExeFile As String, WorkDir As String, ExeArgs As String, IconFile As String, IconIdx As Long, LnkDesc As String, ShowCmd As Long) |
DeleteShortcut
|
Delete a shortcut. The function returns a Boolean value. (True if successful) Function DeleteShortcut(LnkFile As String) |
Usage:
Sub Scense_Main() 'Show Window Const Hidden_Inactive = 0 Const Normal_Active = 1 Const Minimized_Active = 2 Const Maximized_Active = 3 Const Normal_no_Activate = 4 Const Show_Active = 5 Const Minimize_Inactive = 6 Const Minimize_No_Activate = 7 Const Show_No_Activate = 8 With Shortcut 'Create a shortcut If Not .CreateShortcut(ReplaceVariables("%Desktop%\Test.lnk"), _ "c:\windows\notepad.exe", "c:\windows", "", _ "c:\windows\notepad.exe", 0, _ "Edit text files", Normal_Active) Then .WriteScenseLog .ResultCode End If 'Delete a shortcut If Not .DeleteShortcut(ReplaceVariables("%Desktop%\Test.lnk")) Then .WriteScenseLog .ResultCode End If End With End Sub