Results 1 to 7 of 7

Thread: Simpliest way to get a pointer to IShellItemImageFactory

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    832

    Simpliest way to get a pointer to IShellItemImageFactory

    Here is the most simpliest way to get access to the images/icons/thumbnails!!
    All you need is a typelib that supports IShellItem and IShellItemImageFactory.

    Here we go!!

    Code:
    Public Function ShGetIShellItemFromItemId(ByVal pidl As Long, ByRef pISI As IShellItem) As Long
      Dim hr As Long
      
      Set pISI = Nothing
      
      If pidl = 0 Then Exit Function
      
      hr = SHCreateItemFromIDList(pidl, IID_IShellItem, pISI)
      
      ShGetIShellItemFromItemId = hr
    End Function
    
    
    Public Function ShIShellItemImageFactory(ByVal pidl As Long, ByRef pISIIF As IShellItemImageFactory) As Long
      Dim hr As Long
      Dim pISI As IShellItem
      
      hr = ShGetIShellItemFromItemId(pidl, pISI)
      
      If hr = S_OK Then
        Set pISIIF = pISI
      End If
    End Function
    Cheers and have fun

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,704

    Re: Simpliest way to get a pointer to IShellItemImageFactory

    Well if we're having a simplest competition...

    SHCreateItemFromParsingName StrPtr(path), Nothing, IID_IShellItemImageFactory, pisiif

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    832

    Re: Simpliest way to get a pointer to IShellItemImageFactory

    But this was never concived by you earlier for reason I don’t know.
    But for end user (other programmer) will my version be shorter
    Just using:
    ShIShellItemImageFactory pidl, pISIIF

  4. #4
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,704

    Re: Simpliest way to get a pointer to IShellItemImageFactory

    ? It's not clearly documented so I prefer not to use it, but I've got very old code that does.

    I don't see how yours can be shorter than 1 line.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    832

    Re: Simpliest way to get a pointer to IShellItemImageFactory

    Three words for the user ?
    ShIShellItemImageFactory pidl, pISIIF

  6. #6
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,704

    Re: Simpliest way to get a pointer to IShellItemImageFactory

    Oh, you're not counting any of the actual code, ok. I think you should count the code, since it's required, where my version requires only the same references as yours (oleexp+mIID).

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    832

    Re: Simpliest way to get a pointer to IShellItemImageFactory

    ?Storm in a glass of water

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width