Quantcast
Viewing all articles
Browse latest Browse all 1449

Do you need to expose IUknown Inteface WITHOUT INVOLING VB6?

Here to do it and it is straight compatible with Tb since no VB6 code involved.
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

*HINT* All Sets can be changed to use MoveMemory (RTLCopyMemory as its real API name actually is).

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>