Here to do it and it is straight compatible with Tb since no VB6 code involved.
*HINT* All Sets can be changed to use MoveMemory (RTLCopyMemory as its real API name actually is).Code:Public Function GetIUnknown() As oleexp.IUnknown Dim pISF As IShellFolder Dim ppISF As Long Dim pIUnk As oleexp.IUnknown SHGetDesktopFolder ppISF MoveMemory pISF, ppISF, 4 Set pIUnk = pISF Set GetIUnknown = pIUnk End Function Public Function GetIUnknownFromPidl(ByVal pidl As Long) As oleexp.IUnknown Dim pISF As IShellFolder Dim pIUnk As oleexp.IUnknown Dim pISI As IShellItem Dim pIPAI As IParentAndItem SHCreateItemFromIDList pidl, IID_IShellItem, pISI Set pIPAI = pISI pIPAI.GetParentAndItem 0, pISF, 0 Set pIUnk = pISF Set GetIUnknownFromPidl = pIUnk End Function




Reply With Quote