void InitializeObject() { NativeMethods.SHFILEINFO shfi = new NativeMethods.SHFILEINFO(); IntPtr result = IntPtr.Zero; try { result = NativeMethods.SHGetFileInfo(this.pidl, 0, ref shfi, Marshal.SizeOf(shfi), NativeMethods.SHGFI.SHGFI_PIDL | NativeMethods.SHGFI.SHGFI_DISPLAYNAME | NativeMethods.SHGFI.SHGFI_ATTRIBUTES | NativeMethods.SHGFI.SHGFI_TYPENAME ); } catch { System.Diagnostics.Debug.Write("Error in PIDL.InitializeObject"); } displayName = shfi.szDisplayName; iconIndex = shfi.iIcon; typeName = shfi.szTypeName; m_attributes = (NativeMethods.SFGAO)shfi.dwAttributes; StringBuilder sb = new StringBuilder(260); NativeMethods.SHGetPathFromIDList(this.pidl, sb); physicalPath = sb.ToString(); }
private void InitializeObject() { NativeMethods.SHFILEINFO shfi = new NativeMethods.SHFILEINFO(); // Attempt to get the information for the shell object. NativeMethods.SHGetFileInfo( m_pidl, 0, ref shfi, Marshal.SizeOf(shfi), NativeMethods.SHGFI.SHGFI_PIDL | NativeMethods.SHGFI.SHGFI_DISPLAYNAME | NativeMethods.SHGFI.SHGFI_ATTRIBUTES | NativeMethods.SHGFI.SHGFI_TYPENAME ); // Save the information. m_displayName = shfi.szDisplayName; m_typeName = shfi.szTypeName; m_attributes = (NativeMethods.SFGAO)shfi.dwAttributes; StringBuilder sb = new StringBuilder(260); // Get the physical path to the shell object. NativeMethods.SHGetPathFromIDList( m_pidl, sb ); // Save the path. m_physicalPath = sb.ToString(); }