Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than shell32, prefix the name with the module name and a period.
SHGetNameFromIDList (shell32)
.
The format is determined by then SIGDN Enum
C# Signature:
[DllImport("shell32.dll", SetLastError=true)]
static extern TODO SHGetNameFromIDList(TODO);
<System.Runtime.InteropServices.InAttribute()> _
ByVal pidl As System.IntPtr, _
ByVal sigdnName As SIGDN, _
ByRef ppszName As System.IntPtr) As Integer
CANCOPY = &H1 ' Objects can be copied (DROPEFFECT_COPY)
CANMOVE = &H2 ' Objects can be moved (DROPEFFECT_MOVE)
CANLINK = &H4 ' Objects can be linked (DROPEFFECT_LINK)
STORAGE = &H8 ' supports BindToObject(IID_IStorage)
CANRENAME = &H10 ' Objects can be renamed
CANDELETE = &H20 ' Objects can be deleted
HASPROPSHEET = &H40 ' Objects have property sheets
DROPTARGET = &H100 ' Objects are drop target
CAPABILITYMASK = &H177
SYSTEM= &H1000 ' Windows 7 and later. The specified items are system items.
ENCRYPTED = &H2000 ' object is encrypted (use alt color)
ISSLOW = &H4000 ' 'slow' object
GHOSTED = &H8000 ' ghosted icon
LINK = &H10000 ' Shortcut (link)
SHARE = &H20000 ' shared
[READONLY] = &H40000 ' read-only
HIDDEN = &H80000 ' hidden object
DISPLAYATTRMASK = &HFC000
FILESYSANCESTOR = &H10000000 ' may contain children with FILESYSTEM
FOLDER = &H20000000 ' support BindToObject(IID_IShellFolder)
FILESYSTEM = &H40000000 ' is a win32 file system object (file/folder/root)
HASSUBFOLDER = &H80000000UI ' may contain children with FOLDER
CONTENTSMASK = &H80000000UI
VALIDATE = &H1000000 ' invalidate cached information
REMOVABLE = &H2000000 ' is this removeable media?
COMPRESSED = &H4000000 ' Object is compressed (use alt color)
BROWSABLE = &H8000000 ' supports IShellFolder, but only implements CreateViewObject() (non-folder view)
NONENUMERATED = &H100000 ' is a non-enumerated object
NEWCONTENT = &H200000 ' should show bold in explorer tree
CANMONIKER = &H400000 ' defunct
HASSTORAGE = &H400000 ' defunct
STREAM = &H400000 ' supports BindToObject(IID_IStream)
STORAGEANCESTOR = &H800000 ' may contain children with STORAGE or STREAM
STORAGECAPMASK = &H70C50008 ' for determining storage capabilities, ie for open/save semantics
<System.Runtime.InteropServices.DllImportAttribute("shell32.dll", EntryPoint:="ILFree")> _
Private Shared Sub ILFree(<System.Runtime.InteropServices.InAttribute()> ByVal pidl As System.IntPtr)
End Sub
<System.Runtime.InteropServices.DllImportAttribute("shell32.dll", EntryPoint:="SHGetNameFromIDList")> _
Private Shared Function SHGetNameFromIDList( _
<System.Runtime.InteropServices.InAttribute()> _
ByVal pidl As System.IntPtr, _
ByVal sigdnName As SIGDN, _
ByRef ppszName As System.IntPtr) As Integer
End Function
<System.Runtime.InteropServices.DllImportAttribute("shell32.dll", EntryPoint:="SHParseDisplayName")> _
Private Shared Function SHParseDisplayName( _
<DllImport("shell32.dll")>
Private Shared Function SHGetFolderLocation(hwndOwner As IntPtr, nFolder As Integer,
hToken As IntPtr, dwReserved As UInteger, ByRef ppidl As IntPtr) As Integer
End Function
#End Region
Public Shared Function GetNameFromPIDL(pidl As IntPtr, _
displayType As SIGDN) As String
Dim ptr As IntPtr = Marshal.AllocHGlobal(300)
SHGetNameFromIDList(pidl, displayType, ptr)
Dim path As String = Marshal.PtrToStringAuto(ptr)
Marshal.FreeHGlobal(ptr)
Return path
End Function
Private Function PIDLFromCSIDL(csidlInt As Integer) As IntPtr
If Not [Enum].IsDefined(GetType(CSIDL), csidlInt) Then Return IntPtr.Zero
Dim ptr As IntPtr = IntPtr.Zero
SHGetFolderLocation(IntPtr.Zero, CInt(csidlInt), IntPtr.Zero, 0, ptr)
Return ptr
End Function
Private Function PIDLFromParseName(parseName As String) As IntPtr
Dim ptr As IntPtr = IntPtr.Zero
SHParseDisplayName(parseName, IntPtr.Zero, ptr, 0, 0)
Return ptr
End Function
'Example = Get ParseName for Control Panel
Public Function ControlPanelParseName() As String
Dim CplCsidl As CSIDL = CSIDL.CONTROLS
Dim ptrLoc As IntPtr = IntPtr.Zero
SHGetFolderLocation(IntPtr.Zero, CInt(CplCsidl), IntPtr.Zero, 0, ptrLoc)
Dim parseName As String = GetNameFromPIDL(ptrLoc, SIGDN.DESKTOPABSOLUTEPARSING)
ILFree(ptrLoc)
Return parseName
End Function
'Example = Get Display Name for 'My Computer'
Public Function ComputerDisplayName() As String
Dim pcCsidl As CSIDL = CSIDL.DRIVES
Dim ptrLoc As IntPtr = IntPtr.Zero
SHGetFolderLocation(IntPtr.Zero, CInt(pcCsidl), IntPtr.Zero, 0, ptrLoc)
Dim displayName As String = GetNameFromPIDL(ptrLoc, SIGDN.NORMALDISPLAY)
ILFree(ptrLoc)
Return displayName
End Function
3/16/2007 7:31:57 AM - anfortas.geo@yahoo.com-216.204.61.86
Click to read this page
10/23/2022 7:47:26 PM - gBqsPxAZ-51.137.182.20
Click to read this page
10/23/2022 7:47:26 PM - gBqsPxAZ-51.137.182.20
Retrieves the display name of an item identified by its IDList.
11/15/2012 12:11:29 PM - -80.79.82.6
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.
4/25/2007 3:19:29 AM - anonymous
ByVal is a VB keyword that specifies a variable to be passed as a parameter BY VALUE. In other words, if the function or sub changes the value of the internal variable, it does not change the value of the external variable that was passed to it.
4/25/2007 3:19:55 AM - josep1er@cmich.edu-141.209.229.179
ByRef is a VB keyword that specifies a variable to be passed as a parameter BY REFERENCE. In other words, the pointer to the variable is passed and any change to its value made within the function or sub will change its value outside the function/sub.
4/25/2007 3:19:29 AM - anonymous
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).