/// <summary> /// Create an empty shell link object /// </summary> public ShellLink() { theShellLinkObject = new ShellLinkCoClass(); shellLink = (IShellLink)theShellLinkObject; dataList = (IShellLinkDataList)theShellLinkObject; consoleProperties = new ConsoleProperties(this); }
/// <summary> /// Create an empty shell link object /// </summary> public ShellLink() { theShellLinkObject = new ShellLinkCoClass(); shellLink = (IShellLink) theShellLinkObject; dataList = (IShellLinkDataList) theShellLinkObject; consoleProperties = new ConsoleProperties(this); }
internal static bool IsMarkedRunAs(string shortcutFile) { Type shellLinkType = Type.GetTypeFromCLSID(new Guid(ShellIIDGuid.CShellLink), true); IPersistFile shellFile = Activator.CreateInstance(shellLinkType) as IPersistFile; if (shellFile != null) { shellFile.Load(shortcutFile, (int)AccessModes.Read); IShellLinkDataList shellLink = (IShellLinkDataList)shellFile; int flags; shellLink.GetFlags(out flags); return((flags & Convert.ToInt32(ShellLinkDataFlags.RunAs)) != 0); } return(false); }
public void Dispose() { GC.SuppressFinalize(this); if (dataList != null) { Marshal.ReleaseComObject(dataList); dataList = null; } if (shellLink != null) { Marshal.ReleaseComObject(shellLink); shellLink = null; } if (theShellLinkObject != null) { Marshal.ReleaseComObject(theShellLinkObject); theShellLinkObject = null; } }