Results 1 to 1 of 1

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

  1. #1

    Thread Starter
    Join Date
    Jul 2010

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

    IExplorerBrowser Custom File List

    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.

    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
            Debug.Print "Error->No RF pointer"
        End If
        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.

    -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.
    Attached Files Attached Files

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