Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Shell32
- {
- public static Type ShellFolderType = typeof(IShellFolder);
- public static Type EnumIDListType = typeof(IEnumIDList);
- public static Guid IID_IShellFolder = new Guid("{000214E6-0000-0000-C000-000000000046}");
- // Retrieves the path of a folder as an PIDL.
- [DllImport("shell32.dll")]
- public static extern Int32 SHGetFolderLocation(
- IntPtr hwndOwner, // Handle to the owner window.
- Int32 nFolder, // A CSIDL value that identifies the folder to be located.
- IntPtr hToken, // Token that can be used to represent a particular user.
- UInt32 dwReserved, // Reserved.
- out IntPtr ppidl); // Address of a pointer to an item identifier list structure
- // specifying the folder's location relative to the root of the namespace
- // (the desktop).
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- public extern static bool DestroyIcon(IntPtr handle);
- // Retrieves the IShellFolder interface for the desktop folder, which is the root of the Shell's namespace.
- [DllImport("shell32.dll")]
- public static extern Int32 SHGetDesktopFolder(
- out IntPtr ppshf); // Address that receives an IShellFolder interface pointer for the
- // desktop folder.
- // Takes a STRRET structure returned by IShellFolder::GetDisplayNameOf, converts it to a string, and
- // places the result in a buffer.
- [DllImport("shlwapi.dll")]
- public static extern Int32 StrRetToBuf(
- ref STRRET pstr, // Pointer to the STRRET structure. When the function returns, this pointer will no
- // longer be valid.
- IntPtr pidl, // Pointer to the item's ITEMIDLIST structure.
- StringBuilder pszBuf, // Buffer to hold the display name. It will be returned as a null-terminated
- // string. If cchBuf is too small, the name will be truncated to fit.
- UInt32 cchBuf); // Size of pszBuf, in characters. If cchBuf is too small, the string will be
- // truncated to fit.
- [DllImport("shell32.dll")]
- public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttribs, out SHFILEINFO psfi, uint cbFileInfo, SHGFI uFlags);
- [DllImport("shell32.dll")]
- public static extern IntPtr SHGetFileInfo(IntPtr pIDL, uint dwFileAttributes, out SHFILEINFO psfi, uint cbFileInfo, SHGFI uFlags);
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- public struct SHFILEINFO
- {
- public SHFILEINFO(bool b)
- {
- hIcon = IntPtr.Zero;
- iIcon = 0;
- dwAttributes = 0;
- szDisplayName = "";
- szTypeName = "";
- }
- /// <summary>Maximal Length of unmanaged Windows-Path-strings</summary>
- private const int MAX_PATH = 260;
- /// <summary>Maximal Length of unmanaged Typename</summary>
- private const int MAX_TYPE = 80;
- public IntPtr hIcon;
- public int iIcon;
- public uint dwAttributes;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH)]
- public string szDisplayName;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_TYPE)]
- public string szTypeName;
- };
- [DllImport("shell32.dll")]
- public static extern IntPtr ILCombine(IntPtr pIDLParent, IntPtr pIDLChild);
- [DllImport("shell32.dll")]
- public static extern void ILFree([In] IntPtr pidl);
- public static IShellFolder GetDesktopFolder()
- {
- IntPtr ptrRet;
- SHGetDesktopFolder(out ptrRet);
- Object obj = Marshal.GetTypedObjectForIUnknown(ptrRet, ShellFolderType);
- IShellFolder ishellFolder = (IShellFolder)obj;
- return ishellFolder;
- }
- /// <summary>
- /// managed equivalent of IShellFolder interface
- /// Pinvoke.net / Mod by Arik Poznanski - pooya parsa
- /// Msdn: http://msdn.microsoft.com/en-us/library/windows/desktop/bb775075(v=vs.85).aspx
- /// Pinvoke: http://pinvoke.net/default.aspx/Interfaces/IShellFolder.html
- /// </summary>
- [ComImport]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [Guid("000214E6-0000-0000-C000-000000000046")]
- public interface IShellFolder
- {
- /// <summary>
- /// Translates a file object's or folder's display name into an item identifier list.
- /// Return value: error code, if any
- /// </summary>
- /// <param name="hwnd">Optional window handle</param>
- /// <param name="pbc">Optional bind context that controls the parsing operation. This parameter is normally set to NULL. </param>
- /// <param name="pszDisplayName">Null-terminated UNICODE string with the display name</param>
- /// <param name="pchEaten">Pointer to a ULONG value that receives the number of characters of the display name that was parsed.</param>
- /// <param name="ppidl"> Pointer to an ITEMIDLIST pointer that receives the item identifier list for the object.</param>
- /// <param name="pdwAttributes">Optional parameter that can be used to query for file attributes.this can be values from the SFGAO enum</param>
- void ParseDisplayName(IntPtr hwnd, IntPtr pbc, String pszDisplayName, UInt32 pchEaten, out IntPtr ppidl, UInt32 pdwAttributes);
- /// <summary>
- ///Allows a client to determine the contents of a folder by creating an item identifier enumeration object and returning its IEnumIDList interface.
- ///Return value: error code, if any
- /// </summary>
- /// <param name="hwnd">If user input is required to perform the enumeration, this window handle should be used by the enumeration object as the parent window to take user input.</param>
- /// <param name="grfFlags">Flags indicating which items to include in the enumeration. For a list of possible values, see the SHCONTF enum. </param>
- /// <param name="ppenumIDList">Address that receives a pointer to the IEnumIDList interface of the enumeration object created by this method. </param>
- void EnumObjects(IntPtr hwnd, ESHCONTF grfFlags, out IntPtr ppenumIDList);
- /// <summary>
- ///Retrieves an IShellFolder object for a subfolder.
- // Return value: error code, if any
- /// </summary>
- /// <param name="pidl">Address of an ITEMIDLIST structure (PIDL) that identifies the subfolder.</param>
- /// <param name="pbc">Optional address of an IBindCtx interface on a bind context object to be used during this operation.</param>
- /// <param name="riid">Identifier of the interface to return. </param>
- /// <param name="ppv">Address that receives the interface pointer.</param>
- void BindToObject(IntPtr pidl, IntPtr pbc, [In]ref Guid riid, out IntPtr ppv);
- /// <summary>
- /// Requests a pointer to an object's storage interface.
- /// Return value: error code, if any
- /// </summary>
- /// <param name="pidl">Address of an ITEMIDLIST structure that identifies the subfolder relative to its parent folder. </param>
- /// <param name="pbc">Optional address of an IBindCtx interface on a bind context object to be used during this operation.</param>
- /// <param name="riid">Interface identifier (IID) of the requested storage interface.</param>
- /// <param name="ppv"> Address that receives the interface pointer specified by riid.</param>
- void BindToStorage(IntPtr pidl, IntPtr pbc, [In]ref Guid riid, out IntPtr ppv);
- /// <summary>
- /// Determines the relative order of two file objects or folders, given
- /// their item identifier lists. Return value: If this method is
- /// successful, the CODE field of the HRESULT contains one of the
- /// following values (the code can be retrived using the helper function
- /// GetHResultCode): Negative A negative return value indicates that the first item should precede the second (pidl1 < pidl2).
- ////
- ///Positive A positive return value indicates that the first item should
- ///follow the second (pidl1 > pidl2). Zero A return value of zero
- ///indicates that the two items are the same (pidl1 = pidl2).
- /// </summary>
- /// <param name="lParam">Value that specifies how the comparison should be performed. The lower Sixteen bits of lParam define the sorting rule.
- /// The upper sixteen bits of lParam are used for flags that modify the sorting rule. values can be from the SHCIDS enum
- /// </param>
- /// <param name="pidl1">Pointer to the first item's ITEMIDLIST structure.</param>
- /// <param name="pidl2"> Pointer to the second item's ITEMIDLIST structure.</param>
- /// <returns></returns>
- [PreserveSig]
- Int32 CompareIDs(Int32 lParam, IntPtr pidl1, IntPtr pidl2);
- /// <summary>
- /// Requests an object that can be used to obtain information from or interact
- /// with a folder object.
- /// Return value: error code, if any
- /// </summary>
- /// <param name="hwndOwner">Handle to the owner window.</param>
- /// <param name="riid">Identifier of the requested interface.</param>
- /// <param name="ppv">Address of a pointer to the requested interface. </param>
- void CreateViewObject(IntPtr hwndOwner, [In] ref Guid riid, out IntPtr ppv);
- /// <summary>
- /// Retrieves the attributes of one or more file objects or subfolders.
- /// Return value: error code, if any
- /// </summary>
- /// <param name="cidl">Number of file objects from which to retrieve attributes. </param>
- /// <param name="apidl">Address of an array of pointers to ITEMIDLIST structures, each of which uniquely identifies a file object relative to the parent folder.</param>
- /// <param name="rgfInOut">Address of a single ULONG value that, on entry contains the attributes that the caller is
- /// requesting. On exit, this value contains the requested attributes that are common to all of the specified objects. this value can be from the SFGAO enum
- /// </param>
- void GetAttributesOf(UInt32 cidl, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)]IntPtr[] apidl, ref ESFGAO rgfInOut);
- /// <summary>
- /// Retrieves an OLE interface that can be used to carry out actions on the
- /// specified file objects or folders. Return value: error code, if any
- /// </summary>
- /// <param name="hwndOwner">Handle to the owner window that the client should specify if it displays a dialog box or message box.</param>
- /// <param name="cidl">Number of file objects or subfolders specified in the apidl parameter. </param>
- /// <param name="apidl">Address of an array of pointers to ITEMIDLIST structures, each of which uniquely identifies a file object or subfolder relative to the parent folder.</param>
- /// <param name="riid">Identifier of the COM interface object to return.</param>
- /// <param name="rgfReserved"> Reserved. </param>
- /// <param name="ppv">Pointer to the requested interface.</param>
- void GetUIObjectOf(IntPtr hwndOwner, UInt32 cidl, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]IntPtr[] apidl, [In] ref Guid riid, UInt32 rgfReserved, out IntPtr ppv);
- /// <summary>
- /// Retrieves the display name for the specified file object or subfolder.
- /// Return value: error code, if any
- /// </summary>
- /// <param name="pidl">Address of an ITEMIDLIST structure (PIDL) that uniquely identifies the file object or subfolder relative to the parent folder. </param>
- /// <param name="uFlags">Flags used to request the type of display name to return. For a list of possible values. </param>
- /// <param name="pName"> Address of a STRRET structure in which to return the display name.</param>
- void GetDisplayNameOf(IntPtr pidl, ESHGDN uFlags, out STRRET pName);
- /// <summary>
- /// Sets the display name of a file object or subfolder, changing the item
- /// identifier in the process.
- /// Return value: error code, if any
- /// </summary>
- /// <param name="hwnd"> Handle to the owner window of any dialog or message boxes that the client displays.</param>
- /// <param name="pidl"> Pointer to an ITEMIDLIST structure that uniquely identifies the file object or subfolder relative to the parent folder. </param>
- /// <param name="pszName"> Pointer to a null-terminated string that specifies the new display name.</param>
- /// <param name="uFlags">Flags indicating the type of name specified by the lpszName parameter. For a list of possible values, see the description of the SHGNO enum.</param>
- /// <param name="ppidlOut"></param>
- void SetNameOf(IntPtr hwnd, IntPtr pidl, String pszName, ESHCONTF uFlags, out IntPtr ppidlOut);
- }
- public enum ESFGAO : uint
- {
- SFGAO_CANCOPY = 0x00000001,
- SFGAO_CANMOVE = 0x00000002,
- SFGAO_CANLINK = 0x00000004,
- SFGAO_LINK = 0x00010000,
- SFGAO_SHARE = 0x00020000,
- SFGAO_READONLY = 0x00040000,
- SFGAO_HIDDEN = 0x00080000,
- SFGAO_FOLDER = 0x20000000,
- SFGAO_FILESYSTEM = 0x40000000,
- SFGAO_HASSUBFOLDER = 0x80000000,
- }
- public enum ESHCONTF
- {
- SHCONTF_FOLDERS = 0x0020,
- SHCONTF_NONFOLDERS = 0x0040,
- SHCONTF_INCLUDEHIDDEN = 0x0080,
- SHCONTF_INIT_ON_FIRST_NEXT = 0x0100,
- SHCONTF_NETPRINTERSRCH = 0x0200,
- SHCONTF_SHAREABLE = 0x0400,
- SHCONTF_STORAGE = 0x0800
- }
- public enum ESHGDN
- {
- SHGDN_NORMAL = 0x0000,
- SHGDN_INFOLDER = 0x0001,
- SHGDN_FOREDITING = 0x1000,
- SHGDN_FORADDRESSBAR = 0x4000,
- SHGDN_FORPARSING = 0x8000,
- }
- // this works too...from Unions.cs
- [StructLayout(LayoutKind.Explicit, Size = 520)]
- public struct STRRETinternal
- {
- [FieldOffset(0)]
- public IntPtr pOleStr;
- [FieldOffset(0)]
- public IntPtr pStr; // LPSTR pStr; NOT USED
- [FieldOffset(0)]
- public uint uOffset;
- }
- [StructLayout(LayoutKind.Sequential)]
- public struct STRRET
- {
- public uint uType;
- public STRRETinternal data;
- }
- public enum CSIDL
- {
- CSIDL_FLAG_CREATE = (0x8000), // Version 5.0. Combine this CSIDL with any of the following
- //CSIDLs to force the creation of the associated folder.
- CSIDL_ADMINTOOLS = (0x0030), // Version 5.0. The file system directory that is used to store
- // administrative tools for an individual user. The Microsoft
- // Management Console (MMC) will save customized consoles to
- // this directory, and it will roam with the user.
- CSIDL_ALTSTARTUP = (0x001d), // The file system directory that corresponds to the user's
- // nonlocalized Startup program group.
- CSIDL_APPDATA = (0x001a), // Version 4.71. The file system directory that serves as a
- // common repository for application-specific data. A typical
- // path is C:\Documents and Settings\username\Application Data.
- // This CSIDL is supported by the redistributable Shfolder.dll
- // for systems that do not have the Microsoft® Internet
- // Explorer 4.0 integrated Shell installed.
- CSIDL_BITBUCKET = (0x000a), // The virtual folder containing the objects in the user's
- // Recycle Bin.
- CSIDL_CDBURN_AREA = (0x003b), // Version 6.0. The file system directory acting as a staging
- // area for files waiting to be written to CD. A typical path
- // is C:\Documents and Settings\username\Local Settings\
- // Application Data\Microsoft\CD Burning.
- CSIDL_COMMON_ADMINTOOLS = (0x002f), // Version 5.0. The file system directory containing
- // administrative tools for all users of the computer.
- CSIDL_COMMON_ALTSTARTUP = (0x001e), // The file system directory that corresponds to the
- // nonlocalized Startup program group for all users. Valid only
- // for Microsoft Windows NT® systems.
- CSIDL_COMMON_APPDATA = (0x0023), // Version 5.0. The file system directory containing application
- // data for all users. A typical path is C:\Documents and
- // Settings\All Users\Application Data.
- CSIDL_COMMON_DESKTOPDIRECTORY = (0x0019), // The file system directory that contains files and folders
- // that appear on the desktop for all users. A typical path is
- // C:\Documents and Settings\All Users\Desktop. Valid only for
- // Windows NT systems.
- CSIDL_COMMON_DOCUMENTS = (0x002e), // The file system directory that contains documents that are
- // common to all users. A typical paths is C:\Documents and
- // Settings\All Users\Documents. Valid for Windows NT systems
- // and Microsoft Windows® 95 and Windows 98 systems with
- // Shfolder.dll installed.
- CSIDL_COMMON_FAVORITES = (0x001f), // The file system directory that serves as a common repository
- // for favorite items common to all users. Valid only for
- // Windows NT systems.
- CSIDL_COMMON_MUSIC = (0x0035), // Version 6.0. The file system directory that serves as a
- // repository for music files common to all users. A typical
- // path is C:\Documents and Settings\All Users\Documents\
- // My Music.
- CSIDL_COMMON_PICTURES = (0x0036), // Version 6.0. The file system directory that serves as a
- // repository for image files common to all users. A typical
- // path is C:\Documents and Settings\All Users\Documents\
- // My Pictures.
- CSIDL_COMMON_PROGRAMS = (0x0017), // The file system directory that contains the directories for
- // the common program groups that appear on the Start menu for
- // all users. A typical path is C:\Documents and Settings\
- // All Users\Start Menu\Programs. Valid only for Windows NT
- // systems.
- CSIDL_COMMON_STARTMENU = (0x0016), // The file system directory that contains the programs and
- // folders that appear on the Start menu for all users. A
- // typical path is C:\Documents and Settings\All Users\
- // Start Menu. Valid only for Windows NT systems.
- CSIDL_COMMON_STARTUP = (0x0018), // The file system directory that contains the programs that
- // appear in the Startup folder for all users. A typical path
- // is C:\Documents and Settings\All Users\Start Menu\Programs\
- // Startup. Valid only for Windows NT systems.
- CSIDL_COMMON_TEMPLATES = (0x002d), // The file system directory that contains the templates that
- // are available to all users. A typical path is C:\Documents
- // and Settings\All Users\Templates. Valid only for Windows
- // NT systems.
- CSIDL_COMMON_VIDEO = (0x0037), // Version 6.0. The file system directory that serves as a
- // repository for video files common to all users. A typical
- // path is C:\Documents and Settings\All Users\Documents\
- // My Videos.
- CSIDL_CONTROLS = (0x0003), // The virtual folder containing icons for the Control Panel
- // applications.
- CSIDL_COOKIES = (0x0021), // The file system directory that serves as a common repository
- // for Internet cookies. A typical path is C:\Documents and
- // Settings\username\Cookies.
- CSIDL_DESKTOP = (0x0000), // The virtual folder representing the Windows desktop, the root
- // of the namespace.
- CSIDL_DESKTOPDIRECTORY = (0x0010), // The file system directory used to physically store file
- // objects on the desktop (not to be confused with the desktop
- // folder itself). A typical path is C:\Documents and
- // Settings\username\Desktop.
- CSIDL_DRIVES = (0x0011), // The virtual folder representing My Computer, containing
- // everything on the local computer: storage devices, printers,
- // and Control Panel. The folder may also contain mapped
- // network drives.
- CSIDL_FAVORITES = (0x0006), // The file system directory that serves as a common repository
- // for the user's favorite items. A typical path is C:\Documents
- // and Settings\username\Favorites.
- CSIDL_FONTS = (0x0014), // A virtual folder containing fonts. A typical path is
- // C:\Windows\Fonts.
- CSIDL_HISTORY = (0x0022), // The file system directory that serves as a common repository
- // for Internet history items.
- CSIDL_INTERNET = (0x0001), // A virtual folder representing the Internet.
- CSIDL_INTERNET_CACHE = (0x0020), // Version 4.72. The file system directory that serves as a
- // common repository for temporary Internet files. A typical
- // path is C:\Documents and Settings\username\Local Settings\
- // Temporary Internet Files.
- CSIDL_LOCAL_APPDATA = (0x001c), // Version 5.0. The file system directory that serves as a data
- // repository for local (nonroaming) applications. A typical
- // path is C:\Documents and Settings\username\Local Settings\
- // Application Data.
- CSIDL_MYDOCUMENTS = (0x000c), // Version 6.0. The virtual folder representing the My Documents
- // desktop item. This should not be confused with
- // CSIDL_PERSONAL, which represents the file system folder that
- // physically stores the documents.
- CSIDL_MYMUSIC = (0x000d), // The file system directory that serves as a common repository
- // for music files. A typical path is C:\Documents and Settings
- // \User\My Documents\My Music.
- CSIDL_MYPICTURES = (0x0027), // Version 5.0. The file system directory that serves as a
- // common repository for image files. A typical path is
- // C:\Documents and Settings\username\My Documents\My Pictures.
- CSIDL_MYVIDEO = (0x000e), // Version 6.0. The file system directory that serves as a
- // common repository for video files. A typical path is
- // C:\Documents and Settings\username\My Documents\My Videos.
- CSIDL_NETHOOD = (0x0013), // A file system directory containing the link objects that may
- // exist in the My Network Places virtual folder. It is not the
- // same as CSIDL_NETWORK, which represents the network namespace
- // root. A typical path is C:\Documents and Settings\username\
- // NetHood.
- CSIDL_NETWORK = (0x0012), // A virtual folder representing Network Neighborhood, the root
- // of the network namespace hierarchy.
- CSIDL_PERSONAL = (0x0005), // The file system directory used to physically store a user's
- // common repository of documents. A typical path is
- // C:\Documents and Settings\username\My Documents. This should
- // be distinguished from the virtual My Documents folder in
- // the namespace, identified by CSIDL_MYDOCUMENTS.
- CSIDL_PRINTERS = (0x0004), // The virtual folder containing installed printers.
- CSIDL_PRINTHOOD = (0x001b), // The file system directory that contains the link objects that
- // can exist in the Printers virtual folder. A typical path is
- // C:\Documents and Settings\username\PrintHood.
- CSIDL_PROFILE = (0x0028), // Version 5.0. The user's profile folder. A typical path is
- // C:\Documents and Settings\username. Applications should not
- // create files or folders at this level; they should put their
- // data under the locations referred to by CSIDL_APPDATA or
- // CSIDL_LOCAL_APPDATA.
- CSIDL_PROFILES = (0x003e), // Version 6.0. The file system directory containing user
- // profile folders. A typical path is C:\Documents and Settings.
- CSIDL_PROGRAM_FILES = (0x0026), // Version 5.0. The Program Files folder. A typical path is
- // C:\Program Files.
- CSIDL_PROGRAM_FILES_COMMON = (0x002b), // Version 5.0. A folder for components that are shared across
- // applications. A typical path is C:\Program Files\Common.
- // Valid only for Windows NT, Windows 2000, and Windows XP
- // systems. Not valid for Windows Millennium Edition
- // (Windows Me).
- CSIDL_PROGRAMS = (0x0002), // The file system directory that contains the user's program
- // groups (which are themselves file system directories).
- // A typical path is C:\Documents and Settings\username\
- // Start Menu\Programs.
- CSIDL_RECENT = (0x0008), // The file system directory that contains shortcuts to the
- // user's most recently used documents. A typical path is
- // C:\Documents and Settings\username\My Recent Documents.
- // To create a shortcut in this folder, use SHAddToRecentDocs.
- // In addition to creating the shortcut, this function updates
- // the Shell's list of recent documents and adds the shortcut
- // to the My Recent Documents submenu of the Start menu.
- CSIDL_SENDTO = (0x0009), // The file system directory that contains Send To menu items.
- // A typical path is C:\Documents and Settings\username\SendTo.
- CSIDL_STARTMENU = (0x000b), // The file system directory containing Start menu items. A
- // typical path is C:\Documents and Settings\username\Start Menu.
- CSIDL_STARTUP = (0x0007), // The file system directory that corresponds to the user's
- // Startup program group. The system starts these programs
- // whenever any user logs onto Windows NT or starts Windows 95.
- // A typical path is C:\Documents and Settings\username\
- // Start Menu\Programs\Startup.
- CSIDL_SYSTEM = (0x0025), // Version 5.0. The Windows System folder. A typical path is
- // C:\Windows\System32.
- CSIDL_TEMPLATES = (0x0015), // The file system directory that serves as a common repository
- // for document templates. A typical path is C:\Documents
- // and Settings\username\Templates.
- CSIDL_WINDOWS = (0x0024), // Version 5.0. The Windows directory or SYSROOT. This
- // corresponds to the %windir% or %SYSTEMROOT% environment
- // variables. A typical path is C:\Windows.
- }
- [ComImport]
- [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- [Guid("000214F2-0000-0000-C000-000000000046")]
- public interface IEnumIDList
- {
- /// <summary>
- /// Retrieves the specified number of item identifiers in the
- /// enumeration sequence and advances the current position by
- /// the number of items retrieved.
- /// </summary>
- /// <param name="celt">Number of elements in the array pointed to by the rgelt parameter.</param>
- /// <param name="rgelt">
- /// Address of an array of ITEMIDLIST pointers that receives the item identifiers. The implementation must allocate these item identifiers
- /// using the Shell's allocator (retrieved by the SHGetMalloc function). The calling application is responsible for freeing the item
- /// identifiers using the Shell's allocator.
- /// </param>
- /// <param name="pceltFetched">
- /// Address of a value that receives a count of the item identifiers actually returned in rgelt. The count can be smaller than the value
- /// specified in the celt parameter. This parameter can be NULL only if celt is one.
- /// </param>
- [PreserveSig()]
- uint Next(uint celt, [MarshalAs(UnmanagedType.LPArray)] IntPtr[] rgelt, out int pceltFetched);
- /// <summary>
- /// Skips over the specified number of elements in the enumeration sequence.
- /// </summary>
- /// <param name="celt">Number of item identifiers to skip.</param>
- [PreserveSig()]
- uint Skip(uint celt);
- /// <summary>
- /// Returns to the beginning of the enumeration sequence.
- /// </summary>
- [PreserveSig()]
- uint Reset();
- /// <summary>
- /// Creates a new item enumeration object with the same contents and state as the current one.
- /// </summary>
- /// <param name="ppenum">
- /// Address of a pointer to the new enumeration object. The calling application must
- /// eventually free the new object by calling its Release member function.
- /// </param>
- [PreserveSig()]
- uint Clone(out IEnumIDList ppenum);
- }
- [Flags]
- public enum SHGFI : int
- {
- /// <summary>get icon</summary>
- Icon = 0x000000100,
- /// <summary>get display name</summary>
- DisplayName = 0x000000200,
- /// <summary>get type name</summary>
- TypeName = 0x000000400,
- /// <summary>get attributes</summary>
- Attributes = 0x000000800,
- /// <summary>get icon location</summary>
- IconLocation = 0x000001000,
- /// <summary>return exe type</summary>
- ExeType = 0x000002000,
- /// <summary>get system icon index</summary>
- SysIconIndex = 0x000004000,
- /// <summary>put a link overlay on icon</summary>
- LinkOverlay = 0x000008000,
- /// <summary>show icon in selected state</summary>
- Selected = 0x000010000,
- /// <summary>get only specified attributes</summary>
- Attr_Specified = 0x000020000,
- /// <summary>get large icon</summary>
- LargeIcon = 0x000000000,
- /// <summary>get small icon</summary>
- SmallIcon = 0x000000001,
- /// <summary>get open icon</summary>
- OpenIcon = 0x000000002,
- /// <summary>get shell size icon</summary>
- ShellIconSize = 0x000000004,
- /// <summary>pszPath is a pidl</summary>
- PIDL = 0x000000008,
- /// <summary>use passed dwFileAttribute</summary>
- UseFileAttributes = 0x000000010,
- /// <summary>apply the appropriate overlays</summary>
- AddOverlays = 0x000000020,
- /// <summary>Get the index of the overlay in the upper 8 bits of the iIcon</summary>
- OverlayIndex = 0x000000040,
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement