Shell32SHGetFileInfo(String, FileAttributes, ShellFileInfo, UInt32, SHGetFileInfoFlags) Method
Retrieves information about an object in the file system,
such as a file, folder, directory, or drive root.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Shell32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)]
public static IntPtr SHGetFileInfo(
string path,
FileAttributes fileAttribs,
ref ShellFileInfo refShellFileInfo,
uint size,
SHGetFileInfoFlags flags
)
<DllImportAttribute("Shell32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true>]
Public Shared Function SHGetFileInfo (
path As String,
fileAttribs As FileAttributes,
ByRef refShellFileInfo As ShellFileInfo,
size As UInteger,
flags As SHGetFileInfoFlags
) As IntPtr
Dim path As String
Dim fileAttribs As FileAttributes
Dim refShellFileInfo As ShellFileInfo
Dim size As UInteger
Dim flags As SHGetFileInfoFlags
Dim returnValue As IntPtr
returnValue = Shell32.SHGetFileInfo(path,
fileAttribs, refShellFileInfo, size,
flags)
public:
[DllImportAttribute(L"Shell32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)]
static IntPtr SHGetFileInfo(
String^ path,
FileAttributes fileAttribs,
ShellFileInfo% refShellFileInfo,
unsigned int size,
SHGetFileInfoFlags flags
)
[<DllImportAttribute("Shell32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true)>]
static member SHGetFileInfo :
path : string *
fileAttribs : FileAttributes *
refShellFileInfo : ShellFileInfo byref *
size : uint32 *
flags : SHGetFileInfoFlags -> IntPtr
No code example is currently available or this language may not be supported.
- path String
-
A pointer to a null-terminated string of maximum length MAX_PATH that contains the path and file name.
Both absolute and relative paths are valid.
If the flags parameter includes the PIDL flag,
this parameter must be the address of an ITEMIDLIST (PIDL) structure that contains the
list of item identifiers that uniquely identifies the file within the Shell's namespace.
The PIDL must be a fully qualified PIDL. Relative PIDLs are not allowed.
If the uFlags parameter includes the UseFileAttributes flag,
this parameter does not have to be a valid file name.
The function will proceed as if the file exists with the specified name and with the
file attributes passed in the fileAttribs parameter.
This allows you to obtain information about a file type by passing just the extension for
path parameter and passing FILE_ATTRIBUTE_NORMAL in fileAttribs parameter
- fileAttribs FileAttributes
-
A combination of one or more file attribute flags.
If flags parameter does not include the
UseFileAttributes flag, this parameter is ignored.
- refShellFileInfo ShellFileInfo
-
Pointer to a ShellFileInfo structure to receive the file information.
- size UInt32
-
The size, in bytes, of the ShellFileInfo structure pointed to by the
refShellFileInfo parameter.
- flags SHGetFileInfoFlags
-
The flags that specify the file information to retrieve.
IntPtr
Returns a value whose meaning depends on the
flags parameter.
If
flags parameter does not contain
ExeType
or
SysIconIndex, the return value is nonzero if successful, or zero otherwise.
If
flags parameter contains the
ExeType flag,
the return value specifies the type of the executable.