Results 1 to 9 of 9

Thread: [VB6] Display search results or other custom file set in IExplorerBrowser

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,654

    Post [VB6] Display search results or other custom file set in IExplorerBrowser

    IExplorerBrowser Custom File List
    IResultsFolder

    About
    Most of my shell projects thus far have focused on displaying locations in the shell, but what if you wanted to display the results of a search or some other list that involves files from all across the system? Turns out this is fairly straightforward to do in IExplorerBrowser using the IResultsFolder interface, which had been previously overlooked and just recently added to oleexp (in v4.5).

    The demo project does this as a search, when the form comes up it first displays an empty ExplorerBrowser until you hit run. The startup routine then queries this blank display for its IResultsFolder interface, which represents the items in it-- none now, but the search will fill it.

    Code:
    '(...)
    pEBrowse.Initialize Frame1.hWnd, rcEB, tFS
    pEBrowse.SetOptions lFlag
    pEBrowse.FillFromObject Nothing, EBF_NODROPTARGET
    pEBrowse.GetCurrentView IID_IFolderView2, pfv
    If (pfv Is Nothing) = False Then
    '    'OPTIONAL
    '    'Customize which columns appear: fill uCol with however many columns (PROPERTYKEY's from mPKEY)
    '    ' you want, then be sure to change the second argument in SetColumns to the number of keys
    '    Dim uCol() As PROPERTYKEY
    '    ReDim uCol(2)
    '    Set pColMgr = pfv
    '    uCol(0) = PKEY_ItemNameDisplay
    '    uCol(1) = PKEY_ItemFolderPathDisplay
    '    uCol(2) = PKEY_Image_Dimensions
    '    pColMgr.SetColumns uCol(0), 3&
    
        pfv.GetFolder IID_IResultsFolder, lprf
        If lprf Then
            vbaObjSetAddRef pResFolder, lprf
        Else
            Debug.Print "Error->No RF pointer"
        End If
    Else
        Debug.Print "Error->No folderview"
    End If
    When you click run, it searches the given folder... you can modify this in any number of ways. The search algorithm here uses shell interfaces to enumerate and PathMatchSpec to compare. You can change search methods, change it to search multiple directories, etc. All that's important is that when you find a match, you add it to the IResultsFolder. The demo adds by IShellItem, but you can also add by pidl. The view is updated automatically as the search runs. The result is like the main picture up top.
    In the code, once the initialization routine has run, the IResultsFolder object is created, so all you have to do is call .AddItem or .AddIDList.

    Custom Columns
    It's also possible to customize which columns you want to show.

    In the demo project, there's optional code (commented out by default) in the initialization routine that shows how to make a list of PROPERTYKEY values to show as the column list. This is why mPKEY is included as a requirement; if you're not going to use custom columns, you can remove that reference.


    Requirements
    -Windows Vista or newer
    -oleexp.tlb v4.5 or higher (previous release from 8/1)
    -oleexp addons mIID.bas and mPKEY.bas (both included in oleexp download; mPKEY can be removed if not using custom columns)

    Future Work
    Next up will be to show how to create a similar 'Results Folder' in my ucShellBrowse project.





    This project now also has an x64 compatible version written in twinBASIC using my WinDevLib successor to oleexp.

    https://github.com/fafalone/ExplorerBrowserCustomView
    Attached Files Attached Files
    Last edited by fafalone; Feb 24th, 2024 at 03:46 PM.

  2. #2
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    I have played around with this a bit and two questions are raised...

    1. Why using SFGAO_DROPTARGET? Find more files if you use SFGAO_HASPROPERTYSHEET or using SFGAO_CANLINK.
    2. pResFldr.AddIDList pidlEnum, pidlOut <--- This is causing error 7 - Out of Memory.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,654

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    1) It's used for determining folders that are normal file system paths to be recursively searched; it's not meant to follow links or search virtual folders or zip files.

    2) That line isn't anywhere in the attached zip, so I can only assume you're again asking for psychic debugging where I read your mind for the code you wrote but didn't post.

  4. #4
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    I have worked this evening on a recursive search ?engine? for a IShellfolder version and it?s almost in goale. However the outgoing pidl pointer for IResultsFolder points to desktop but there is nothing there. So probably it?s just another virtual folder?
    Just in memory as a chache for the browserpane? I start to get a hang of this now. One year of re-learning and learning new stuff.
    But resultsfolder doesn?t need to be IResultsFolder? It can be whatever folder? IShellFolder, IShellItem, IKnownFolder in the IFolderView::GetFolder Method?

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,654

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    Not following your meaning... The desktop is the root for all pidls/shell folders/shell items. It's pretty easy to mix up with Users\name\Desktop. It's represented by 0... i.e. pidlDesktop = VarPtr(0). However you'd get something different with Users\name\Desktop.

    But yes you can navigate IExplorerBrowser with a number of different interfaces.

  6. #6
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    Yes, indeed I did forget to mention it?s not the virtual desktop as you say which i clearly 0 pidl or varptr(0).
    It?s as you say a pointer to user?s desktop.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,654

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    Ok well you'll have to show me with code what you're talking about then.



    Project Update - Since I was looking at it:

    This project now also has an x64 compatible version written in twinBASIC using my WinDevLib successor to oleexp.

    https://github.com/fafalone/ExplorerBrowserCustomView

  8. #8
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    It's just a small change to adding pidls instead of IShellItems.
    Code:
       ShGetItemIdFromShellItem pISI_Enum, pidlEnum <-- Since IShellItem itself not provides any pidls for the enumerated items you self need to get them for each and every item.
       pResFldr.AddIDList pidlEnum, pidlOut <-- Did put them in this method and also offered my self a outgoing pidl for it's virtual destination. However even if I let the pidlOut be 0 I get Error 7 - Out of Memory.
    Maybe I need to create a IShellItem for every pidl I get and again call the API ShGetItemIdFromShellItem?
    Yes, I did have to do that.
    So this code was added.

    Code:
       Set pISITmp = ShGetIShellItemFromItemId(pidlEnum)
       ShGetItemIdFromShellItem pISITmp, pidlEnum
       pResFldr.AddIDList pidlEnum, pidlOut
    Now it's working as it should.
    Last edited by nebeln; Feb 24th, 2024 at 04:40 PM.

  9. #9
    Fanatic Member
    Join Date
    Mar 2023
    Posts
    976

    Re: [VB6] Display search results or other custom file set in IExplorerBrowser

    It seems that the output virtual folder for IResultsFolder is set by default to Users\Desktop.
    Attached Images Attached Images  

Tags for this Thread

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