Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 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;
 }
Example #4
0
 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;
 }