public static IntPtr GetLinkTargetIDL(string lnkPath) { _ShellLinkObject o = null; try { IntPtr ptr; o = new _ShellLinkObject(); ((IPersistFile)o).Load(lnkPath, 0); ((IShellLinkW)o).GetIDList(out ptr); return(ptr); } catch { } finally { if (o != null) { Marshal.ReleaseComObject(o); } } return(IntPtr.Zero); }
public static string GetLinkTargetPath(string lnkPath) { _ShellLinkObject o = null; try { o = new _ShellLinkObject(); ((IPersistFile)o).Load(lnkPath, 0); IShellLinkW kw = (IShellLinkW)o; StringBuilder pszFile = new StringBuilder(260); kw.GetPath(pszFile, 260, IntPtr.Zero, 0); return(pszFile.ToString()); } catch { } finally { if (o != null) { Marshal.ReleaseComObject(o); } } return(string.Empty); }
public static string GetLinkTargetPath(string lnkPath) { _ShellLinkObject o = null; try { o = new _ShellLinkObject(); ((IPersistFile)o).Load(lnkPath, 0); IShellLinkW kw = (IShellLinkW)o; StringBuilder pszFile = new StringBuilder(260); kw.GetPath(pszFile, 260, IntPtr.Zero, 0); return pszFile.ToString(); } catch { } finally { if(o != null) { Marshal.ReleaseComObject(o); } } return string.Empty; }
public static IntPtr GetLinkTargetIDL(string lnkPath) { _ShellLinkObject o = null; try { IntPtr ptr; o = new _ShellLinkObject(); ((IPersistFile)o).Load(lnkPath, 0); ((IShellLinkW)o).GetIDList(out ptr); return ptr; } catch { } finally { if(o != null) { Marshal.ReleaseComObject(o); } } return IntPtr.Zero; }