N
Nicola Garone
Hi all,
I need to enumerate pidl in a directory which I got (I think) the rigt
pidl, but I don't know how to procede.
here is a piece of code (folder is a IShellFolder object and it seems to
work correctly)
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr
folder.EnumObjects(IntPtr.Zero, _
COM.ShellAPI.API.SHCONTF.SHCONTF_FOLDERS Or _
COM.ShellAPI.API.SHCONTF.SHCONTF_NONFOLDERS, _
pidEnum)
Now pidEnum got a value and this make me thind folder.EnumObjects works
well
but OF COURSE idEnum (which I must use) is Nothing since is not initialized
so I can't use
Dim hRes As Integer
hRes = idEnum.Next(1, pidl, fetched)
I tried:
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr =
Marshal.AllocHGlobal(Marshal.SizeOf(idEnum))
' this give me an error "Value can't be null"
I also tried:
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr
folder.EnumObjects(IntPtr.Zero, ... bla bla bla)
Marshal.StructureToPtr(idEnum, pidEnum, False)
' this also give me an error "Value can't be null"
I also tried:
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr
Marshal.PtrToStructure(pidEnum, idEnum)
' this also give me an error "Value can't be null"
this is how I defined EnumObjects
<PreserveSig()> _
Function EnumObjects(ByVal hwnd As IntPtr, ByVal grfFlags As
COM.ShellAPI.SHCONTF, ByRef ppenumIDList As IntPtr) As Int32
what am I missing?
Thanks in advance
Nicola Garone
I need to enumerate pidl in a directory which I got (I think) the rigt
pidl, but I don't know how to procede.
here is a piece of code (folder is a IShellFolder object and it seems to
work correctly)
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr
folder.EnumObjects(IntPtr.Zero, _
COM.ShellAPI.API.SHCONTF.SHCONTF_FOLDERS Or _
COM.ShellAPI.API.SHCONTF.SHCONTF_NONFOLDERS, _
pidEnum)
Now pidEnum got a value and this make me thind folder.EnumObjects works
well
but OF COURSE idEnum (which I must use) is Nothing since is not initialized
so I can't use
Dim hRes As Integer
hRes = idEnum.Next(1, pidl, fetched)
I tried:
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr =
Marshal.AllocHGlobal(Marshal.SizeOf(idEnum))
' this give me an error "Value can't be null"
I also tried:
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr
folder.EnumObjects(IntPtr.Zero, ... bla bla bla)
Marshal.StructureToPtr(idEnum, pidEnum, False)
' this also give me an error "Value can't be null"
I also tried:
Dim idEnum As IEnumIDList
Dim pidEnum As IntPtr
Marshal.PtrToStructure(pidEnum, idEnum)
' this also give me an error "Value can't be null"
this is how I defined EnumObjects
<PreserveSig()> _
Function EnumObjects(ByVal hwnd As IntPtr, ByVal grfFlags As
COM.ShellAPI.SHCONTF, ByRef ppenumIDList As IntPtr) As Int32
what am I missing?
Thanks in advance
Nicola Garone