ShellLink class
Namespace: Velopack.Windows
Summary description for ShellLink.
[ExcludeFromCodeCoverage]
public class ShellLink : IDisposable
Implements: IDisposable
Constructors
| Constructor | Summary |
|---|---|
ShellLink | Creates an instance of the Shell Link object. |
ShellLink | Creates an instance of a Shell Link object |
ShellLink()
public ShellLink()
Creates an instance of the Shell Link object.
ShellLink(linkFile)
public ShellLink(string linkFile)
Creates an instance of a Shell Link object from the specified link file
Parameters
| Name | Type | Description |
|---|---|---|
linkFile | string | The Shortcut file to open |
Properties
| Property | Summary |
|---|---|
ShortCutFile | |
IconPath | Gets the path to the file containing the icon for this shortcut. |
IconIndex | Gets the index of this icon within the icon path's resources |
Target | Gets/sets the fully qualified path to the link's target |
WorkingDirectory | Gets/sets the Working Directory for the Link |
Description | Gets/sets the description of the link |
Arguments | Gets/sets any command line arguments associated with the link |
DisplayMode | Gets/sets the initial display mode when the shortcut is |
HotKey | Gets/sets the HotKey to start the shortcut (if any) |
ShortCutFile
public string ShortCutFile { get; set; }
IconPath
public string IconPath { get; set; }
Gets the path to the file containing the icon for this shortcut.
IconIndex
public int IconIndex { get; set; }
Gets the index of this icon within the icon path's resources
Target
public string Target { get; set; }
Gets/sets the fully qualified path to the link's target
WorkingDirectory
public string WorkingDirectory { get; set; }
Gets/sets the Working Directory for the Link
Description
public string Description { get; set; }
Gets/sets the description of the link
Arguments
public string Arguments { get; set; }
Gets/sets any command line arguments associated with the link
DisplayMode
public ShellLink.LinkDisplayMode DisplayMode { get; set; }
Gets/sets the initial display mode when the shortcut is run
HotKey
public short HotKey { get; set; }
Gets/sets the HotKey to start the shortcut (if any)
Methods
| Method | Summary |
|---|---|
~ShellLink | Call dispose just in case it hasn't happened yet |
Dispose | Dispose the object, releasing the COM ShellLink object |
GetIcon | This pointer must be destroyed with DistroyIcon when you are done with it. |
SetAppUserModelId | Sets the appUserModelId |
SetToastActivatorCLSID | Sets the ToastActivatorCLSID |
SetToastActivatorCLSID | Sets the ToastActivatorCLSID |
Save | Saves the shortcut to ShortCutFile. |
Save | Saves the shortcut to the specified file |
Open | Loads a shortcut from the specified file |
Open | Loads a shortcut from the specified file, and allows flags controlling |
Open | Loads a shortcut from the specified file, and allows flags controlling |
~ShellLink()
protected ~ShellLink()
Call dispose just in case it hasn't happened yet
Dispose()
public void Dispose()
Dispose the object, releasing the COM ShellLink object
GetIcon(large)
public nint GetIcon(bool large)
This pointer must be destroyed with DistroyIcon when you are done with it.
Parameters
| Name | Type | Description |
|---|---|---|
large | bool | Whether to return the small or large icon |
Returns nint
SetAppUserModelId(appId)
public void SetAppUserModelId(string appId)
Sets the appUserModelId
Parameters
| Name | Type | Description |
|---|---|---|
appId | string |
SetToastActivatorCLSID(clsid)
public void SetToastActivatorCLSID(string clsid)
Sets the ToastActivatorCLSID
Parameters
| Name | Type | Description |
|---|---|---|
clsid | string |
SetToastActivatorCLSID(clsid)
public void SetToastActivatorCLSID(Guid clsid)
Sets the ToastActivatorCLSID
Parameters
| Name | Type | Description |
|---|---|---|
clsid | Guid |
Save()
public void Save()
Saves the shortcut to ShortCutFile.
Save(linkFile)
public void Save(string linkFile)
Saves the shortcut to the specified file
Parameters
| Name | Type | Description |
|---|---|---|
linkFile | string | The shortcut file (.lnk) |
Open(linkFile)
public void Open(string linkFile)
Loads a shortcut from the specified file
Parameters
| Name | Type | Description |
|---|---|---|
linkFile | string | The shortcut file (.lnk) to load |
Open(linkFile, hWnd, resolveFlags)
public void Open(string linkFile, nint hWnd, ShellLink.EShellLinkResolveFlags resolveFlags)
Loads a shortcut from the specified file, and allows flags controlling the UI behaviour if the shortcut's target isn't found to be set.
Parameters
| Name | Type | Description |
|---|---|---|
linkFile | string | The shortcut file (.lnk) to load |
hWnd | nint | The window handle of the application's UI, if any |
resolveFlags | ShellLink.EShellLinkResolveFlags | Flags controlling resolution behaviour |
Open(linkFile, hWnd, resolveFlags, timeOut)
public void Open(string linkFile, nint hWnd, ShellLink.EShellLinkResolveFlags resolveFlags, ushort timeOut)
Loads a shortcut from the specified file, and allows flags controlling the UI behaviour if the shortcut's target isn't found to be set. If no SLR_NO_UI is specified, you can also specify a timeout.
Parameters
| Name | Type | Description |
|---|---|---|
linkFile | string | The shortcut file (.lnk) to load |
hWnd | nint | The window handle of the application's UI, if any |
resolveFlags | ShellLink.EShellLinkResolveFlags | Flags controlling resolution behaviour |
timeOut | ushort | Timeout if SLR_NO_UI is specified, in ms. |
Generated from Velopack 1.1.1