R
Robin Tucker
I can't get this damned IEnumIDList thing to work correctly. I've got the
desktop folder as an IShellObject (which I've verified by being able to get
the display name etc. from it). I can also get a pointer to the IEnumIDList
object via. GetIEnum. It even allows me to execute the "Fetch" method on
the interface (changed from "Next" because next is a VB keyword - in any
case, its just a function pointer in the VTable). But COM_pIDL always
returns zero in this case. I would expect at least a pointer to some child
pidls or something.
I know this is "VB", but I seem to be doing everything in the same was as
the C# and C++ demos I've seen. Maybe you can spot something dodgy here? :
(apologies for the cross post to the interop group but I'm not sure if you
guys check both)
Public Function GetDesktop() As ShellFolder
' Get the root folder from the shell
Dim COM_theRoot As ShellLib.IShellFolder
COM_theRoot = ShellLib.ShellFunctions.GetDesktopFolder()
If COM_theRoot Is Nothing Then
Exit Function
End If
' the above works, I've verified it returns the "Desktop" IShellFolder
Dim COM_theEnum As ShellLib.IEnumIDList =
ShellLib.ShellFunctions.GetIEnum(COM_theRoot)
Dim COM_pIDL As IntPtr
Try
Do
COM_theEnum.Fetch(1, COM_pIDL, 0)
Debug.WriteLine(COM_pIDL.ToString())
Loop While not COM_pIDL.Equals(IntPtr.Zero)
Catch Ex As Exception
End Try
End Function
' /////////////////////////////////////////////////////////////////////////
' //
' // IEnumIDList
' //
' /////////////////////////////////////////////////////////////////////////
<ComImportAttribute(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("000214F2-0000-0000-C000-000000000046")> _
Public Interface IEnumIDList
<PreserveSig()> _
Function Fetch(ByVal cElt As Integer, ByVal rGelt As IntPtr, ByRef
pCeltFetched As Integer) As Integer
<PreserveSig()> _
Sub Skip(ByVal cElt As Integer)
<PreserveSig()> _
Sub Reset()
<PreserveSig()> _
Sub Clone(ByRef pEnum As IEnumIDList)
End Interface
desktop folder as an IShellObject (which I've verified by being able to get
the display name etc. from it). I can also get a pointer to the IEnumIDList
object via. GetIEnum. It even allows me to execute the "Fetch" method on
the interface (changed from "Next" because next is a VB keyword - in any
case, its just a function pointer in the VTable). But COM_pIDL always
returns zero in this case. I would expect at least a pointer to some child
pidls or something.
I know this is "VB", but I seem to be doing everything in the same was as
the C# and C++ demos I've seen. Maybe you can spot something dodgy here? :
(apologies for the cross post to the interop group but I'm not sure if you
guys check both)
Public Function GetDesktop() As ShellFolder
' Get the root folder from the shell
Dim COM_theRoot As ShellLib.IShellFolder
COM_theRoot = ShellLib.ShellFunctions.GetDesktopFolder()
If COM_theRoot Is Nothing Then
Exit Function
End If
' the above works, I've verified it returns the "Desktop" IShellFolder
Dim COM_theEnum As ShellLib.IEnumIDList =
ShellLib.ShellFunctions.GetIEnum(COM_theRoot)
Dim COM_pIDL As IntPtr
Try
Do
COM_theEnum.Fetch(1, COM_pIDL, 0)
Debug.WriteLine(COM_pIDL.ToString())
Loop While not COM_pIDL.Equals(IntPtr.Zero)
Catch Ex As Exception
End Try
End Function
' /////////////////////////////////////////////////////////////////////////
' //
' // IEnumIDList
' //
' /////////////////////////////////////////////////////////////////////////
<ComImportAttribute(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("000214F2-0000-0000-C000-000000000046")> _
Public Interface IEnumIDList
<PreserveSig()> _
Function Fetch(ByVal cElt As Integer, ByVal rGelt As IntPtr, ByRef
pCeltFetched As Integer) As Integer
<PreserveSig()> _
Sub Skip(ByVal cElt As Integer)
<PreserveSig()> _
Sub Reset()
<PreserveSig()> _
Sub Clone(ByRef pEnum As IEnumIDList)
End Interface