예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShellLink"/> class.
 /// </summary>
 public ShellLink()
 {
     if (System.Environment.OSVersion.Platform == PlatformID.Win32NT)
     {
         _linkW = (NativeMethods.IShellLinkW)new NativeMethods.CShellLink();
     }
     else
     {
         _linkA = (NativeMethods.IShellLinkA)new NativeMethods.CShellLink();
     }
 }
예제 #2
0
        private void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (_linkW != null)
                    {
                        Marshal.FinalReleaseComObject(_linkW);
                        _linkW = null;
                    }

                    if (_linkA != null)
                    {
                        Marshal.FinalReleaseComObject(_linkA);
                        _linkA = null;
                    }
                }

                _disposed = true;
            }
        }