dcsimg
Page 1 of 2 12 LastLast
Results 1 to 40 of 71

Thread: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive features

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Post [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive features




    ucShellBrowse v6.2
    Released 29 Jun 2019
    | Jump to download

    About
    This project started its life as an attempt to select a file right on a Property Page without having to click an additional button. There's still a lot of outstanding issues severely limiting the practicality, usability, and stability of that version, so pending further development on that I continued to make a UserControl version. This is basically having an updated, prettier version of VB's DirList/FileListBox, with further options that allow it to have the power of an actual Explorer window-- but doing it with a ComboBoxEx and ListView allow for customizations and features not possible if you were to simply host an instance of Explorer itself instead. It integrates many of the techniques my small sample projects have shown over the past few years.
    Probably the most interesting thing you'll find is the deep dive into the Property System that was involved in recreating Explorer's Details Pane. There's the official documentation of course, but I've never seen any actual code in any language, let alone VB, that takes things all the way down to figuring out which properties should be in the detail bar set, what type of properties they are, listing ranges or combolists full of specialized items like the dozens of different 'Flash Mode' options on a photo, and actually editing and writing it all back on top of reading.

    Key Features
    • Explorer-style Details Pane that shows all the same fully formatted properties. Editing properties is supported, including pop-up DateTime and ComboBox controls where needed.
    • Dynamic Drag-Drop: Drop on a folder or zip file within the current directory.
    • Keeps up with changes to the current directory by watching SHChangeNotify
    • Full Unicode support
    • Icons, display names, and properties are identical to what a user sees in Explorer. Includes overlay icons for things like shares or links; supports custom ones like used by DropBox or Github.
    • Full navigation tree from the desktop-- virtual objects that are part of the file system, such as Computer or Libraries, are able to be used normally, and the selections real file system path is resolved and returned.
    • Support for several different view modes: Large icon, small icon, list, details, tiles, and thumbnails.
    • Thumbnail View uses the code from my ThumbsEx project, which goes beyond what Explorer can do by using GDI+ to center and frame images smaller than the thumbnail size. The thumbnail size can be set to any value.
    • Optional setting to enable extended thumbnails, like video files showing the first frame.
    • Images and all types with a registered preview handler can be previewed in an optional preview pane.
    • 'Group by' is fully implemented; can group for extended properties
    • Right click brings up the standard shell context menu
    • Sort is supported for all columns and uses the same API that is used by Explorer, so order is identical
    • A filter can be applied to only show files matching a certain type (PathMatchSpecW); an option specifies whether it's single-select or multi-select.
    • Supports rename-in-place with ListView LabelEdit, with blocks and warning popups to prevent disallowed characters. Renames are carried out through Explorer via IFileOperation.
    • Rename, and other functionality, is still supported even if file name extensions are hidden (the ListView uses the Explorer displayname, so if they're hidden in Explorer they're hidden here)
    • Supports 'Create new folder' where a new folder is created, with its name the next in sequence if needed, and a label edit to rename is automatically initiated.
    • Supports both dragging out and receiving dropped files, complete with the file icons you see in Explorer. Drops go through Explorer, meaning 3rd party shell extensions like WinRAR are supported.
    • All column headers found in Explorer are available to be added/removed/sorted by/grouped by, directly interfacing with the Windows Property System and each files Property Store.
    • Default column headers are loaded for each folder from Explorer; so when you browse to your Music library you get Artist, Album, Title, and Track as the columns (this behavior can be disabled)
    • Optional status bar that shows the number of files, their total size, and menu item help. A custom message can also be set.
    • The Back/Up/View control box can be shown or hidden; this combined with option to limit or turn off columns allows for compacting down to the same size as the original VB file browsing controls. ListView icons can even be hidden.
    • There's substantial interaction with the host form, informing your program of selection change, clicks, double clicks/enter press, directory change, renames, and file drops. These events provide both full paths and references to the file(s) IShellItem(Array) interfaces
    • The startup path can be customized and is remembered. The current path can be manually changed through a .BrowserPath property.
    • Custom draw is used to show encrypted files in green and compressed files in blue to be consistent with Explorer (this can also be forced on or forced off)
    • A footer bar can be added to the file list (like in Explorer search results).
    • Explorer-style tool tips show details about the selected item; the properties shown depend on the file type, loading the same ones as Explorer does.

    There's also fairly extensive debug output to the Immediate window. You can stop it from appearing by changing the option: Private Const dbg_PrintToImmediate As Boolean = True --Change it to False to stop debug printing. This and other code options immediately follows the changelog in ucShellBrowse.ctl.

    Requirements
    -Windows Vista or newer
    -If using this as a .ctl, your project must have a reference to oleexp.tlb v4.42 or higher (released 13 Apr 2018).

    (Tested on Windows 7 Ent, Windows 8 Pro, and Windows 10 1709/Fall Creators)

    Strongly recommended:
    -Common Controls 6.0 manifest (for a tool to make them, see LaVolpe's Manifest Creator). The control does work without this, but some features are missing/degraded. Button icons in the control box won't show up. The View mode (Details, Large Icons, List, etc) can't be changed at runtime. Group mode, tile view, thumbnail view, and footer items are all unavailable. When renaming, the extension can't be excluded by default.

    The resource file in the download and used by the demo projects contains a manifest. It also turns on DPI awareness, since this control does its own high DPI support. Further, it contains high quality images for menus and buttons (poor quality without it).
    For other combinations of these features, jump down to Alternative Resource Files
    NOTE: UPDATED - A new version of the Bookmark icon was needed for ucShellBrowse v5.3 so if you're using one of these alternatives, please download the new version marked v2.

    Compiling to OCX
    It's very simple to use the control as an OCX: Open ShellBrowse.vbp from the main folder, in the properties for the control, change Public to True, you can then compile. Then proceed to move, register, and use as you would any other .ocx. A project with the OCX does not require oleexp.tlb. If needed I could also send the compiled OCX, just ask here or PM.

    The demo projects use the control as a .ctl.

    UPDATE : Version 6.2 Released on 29 Jun 2019
    Update to 6.2:Made some important bug fixes and added some last minute minor features.


    Update to 6.1: Made some major improvements in the virtual device Win10 navigation issue, and had some bugs that should be fixed sooner, so updated the project again. Sorry for the short timespan on the updates, I didn't think I'd be able to fix it that quick, and the bugs could be a little confusing.
    NOTE: ResImagesStd.res has changed for 6.x, make sure you replace your old one if it's from 5.x or earlier.

    Code:
    'New in v6.2
    '---NOTE--- This control has a number of keyboard shortcuts, please remember that
    '           the ListView must have focus to use them... However, if the host form
    '           has the same shortcut, the command will go to the form even if the
    '           ListView is focused.
    '
    '-Status updates are now given during a file search with the current folder which
    ' is being searched.
    '
    '-Added optional Destroy flag for SetPreviewPictureWith___ functions.
    '
    '-Added option PreviewVideoAsThumb, which forces videos to display a thumbnail as
    ' its preview in the Preview Pane, instead of loading the regular preview handler,
    ' which typically loads an instance of a video player to play the first few seconds;
    ' this might be slow, and a static image might be preferable. Off by default.
    '
    '-The Search Box toggle will no longer appear on the View menu if the control is in
    ' Files Only or Drives Only mode.
    '
    '-Handling for WM_UNICHAR/WM_IME_CHAR
    '
    '-By request, SetFocusOnFiles now has an optional parameter that will set focus to the
    ' first item if no item was previously focused, and a second option to specify if that
    ' first item must be a file and not a folder.
    '
    '-(Bug fix) If the shell context menu was disabled, it would also prevent the View menu
    '           from popping up on a background click even if it was enabled.
    '
    '-(Bug fix) FilterBarApplyManually was not working.
    '
    '-(Bug fix) In Thumbnail View, the thumbnail for the first file loaded in a folder
    '           was not being generated in some circumstances (it fell back to the normal
    '           file type icon).
    '
    '-(Bug fix) With previews, there may have been a memory leak due to not freeing a
    '           pointer to GlobalAlloc memory before reassigning it or exiting app.
    '           Potentially related to mysterious crashes as well.
    '
    '-(Bug fix) If you enabled one of the control box items while the control box was
    '           disabled, it would show the control box anyway, and in the wrong spot to
    '           compound the problem. Now, enabling a control box item won't show the
    '           control box, but the setting change is made and will be reflected if you
    '           re-enable the control box.
    '
    '-(Bug fix) Pressing the Alt key while the host form has focus, then setting focus
    '           onto the control, resulted in it being like the Alt key was held, leading
    '           unintentional commands being performed.
    '
    '-(Bug fix) Under some particular Windows 10 versions and/or circumstances, the ComboBox
    '           would not stay down. To prevent this, in CBWndProc I added a sanity check to
    '           block a closeup if the box had been opened in the previous 10ms (i.e. much
    '           faster than a human could be doing it). This doesn't seem to cause any issues
    '           but if it does let me know.
    '
    'New in v6.1
    '-Substantially improved virtual device navigation on Windows 10. Up and Refresh
    ' should always work, Back/Forward should normally work, and infotips now work (on
    ' files only, folders apparently do not support them).
    '
    '-The graphical percent free progress bar (if enabled) is now auto-added wherever
    ' it's likely to appear, instead of just Computer, since it also appears in attached
    ' devices like phones showing their internal storage. This is done by checking if it
    ' also has a Free Space column, I don't think that would appear without the other.
    '
    '-(Bug fix) IsIDE was accidentally being called from the demo module, so an error
    '           occured in a project without it. It's now been added to the .ctl.
    '
    '-(Bug fix) The Forward button was not disabled if you created a new end of the
    '           history list by going back then going to a new location.
    '
    If there's another feature you'd like to see don't hesitate to suggest it
    SEE ALSO: If you'd rather use a TreeView to navigate (or even choose files), you might be interested in ucShellTree, my new Shell Tree Control. Like this project, it implements nearly all of the functionality from Explorer and some additional ones. It can work seamlessly with this project-- see the ucShellBrowse DemoEx sample.



    This project is complicated and still under development
    And I'm doing it for fun in my spare time, so don't expect commercial production grade code. I know basic functionality is working right now, and every feature was working when it was added, but there's almost certainly going to be a few bugs here and there in the 20,000 lines that make up this extensive project. It's simply not possible to test every feature in every scenario it may encounter.
    So if you encounter a bug, kindly let me know and I'll get it fixed for the next release.
    Since it's still under active development, there's also a lot of commented out debug code left in, and definitions from common control headers that aren't used. This will be cleaned up once it's feature-complete. (It's also a principle of mine, I'm always curious and interested in seeing these kind of things in others code, so I tend to leave it in for my projects in this forum, in case anyone else shares my interest). If you wish to disable the debug output, there's a single variable immediately following the changelog in ucShellBrowse.ctl: Private Const dbg_PrintToImmediate As Boolean.

    Enjoy!
    Attached Files Attached Files
    Last edited by fafalone; Jun 29th, 2019 at 09:50 PM. Reason: New Version!

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Known Issues

    • If you navigate from one location that uses the Percent Full progress bar to another, the bar gets placed in the wrong column. To fix this immediately instead of waiting for the next version:
      1) Go to the LVLoadFolder routine in ucShellBrowse.ctl.
      2) Near the top, a couple dozen or so lines after the Dim statements ends, locate the block If (siParent Is Nothing) = False Then
      3) Make a new line after m_CurSize and add Call ResetSpecialCols

      And that's it.

    • If you group by Type, switch to another grouping, then switch back to Type, all items are hidden. To fix this immediately, go to the InsertGroupRebuildTypes sub and add the following line immediately after For i = ... (inside the loop):
      gidType(i).bInserted = False

    • Sometime between version 6.1 and 6.2, a line disappeared from SetFileRating2 which caused file ratings to no longer be settable from clicking the stars in the ListView. To fix this now instead of waiting for the next version, go to the SetFileRating2 function, and immediately after the line
      vvar = CVar(lRating)
      add the line
      oleexp.SHCreateItemFromParsingName StrPtr(LVEntries(llp).sFullPath), Nothing, IID_IShellItem2, isi

      (This is only needed for the current version, 6.2, earlier versions have that line present.)

    • Win10 navigation in certain virtual devices should now be mostly fixed in 6.1. If somewhere it's not, let me know.
      Note: To navigate these devices in conjunction with ucShellTree requires updating to ucShellTree v2.12 (released 16 June 2019) or higher, and changing the navigation commands on the form. ucShellBrowse's DemoEx sample project has not been updated, but the very similar DemoSB included with ucShellTree 2.12 or higher does. You just need to pass an IShellItem to the browser instead of the path name:
      Code:
      Private Sub ucShellTree1_ItemSelect(sName As String, sFullPath As String, bFolder As Boolean, hItem As Long)
          If bFolder Then
              'Opening with the path name won't work for phones/cameras/etc on Windows 10 because of an API bug.
      '        ucShellBrowse1.BrowserPath = sFullPath
              'So we'll keep the event trigger but use the shell item instead
              ucShellBrowse1.BrowserOpenItem ucShellTree1.SelectedShellItem
          End If
      End Sub
      No changes are required to the ucShellBrowse1_DirectoryChanged sub (other than having the new version of ucShellTree).

    • When OS zoom is set to other than 100% and dpiAware is not enabled in the manifest (or 'Disable display scaling on high-DPI settings' checked on the Properties->Compatibility tab), use of the shell context menu triggers graphical glitches. Subsequent right-clicks will have the menu pop-up nowhere near where clicked, and if running from the IDE all sorts of distortions in it.
      There's no known fix for this issue, which effects numerous VB6 apps. If you use 100% scaling, it won't effect you, otherwise, the workaround is using the dpiAware=true or 'Disable scaling' options; ucShellBrowse is DPI-aware and scales itself.

    • If you have 64-bit Microsoft Office installed and its msoshext.dll is the registered property handler for post-2007 Office files (typically those with an 'x' in the extension, .docx, .xlsx, etc), you will not be able to view/edit the custom properties like Author, Title, etc in the Details Pane or display columns. There does not seem to be any possible fix for this, as there's no way to load a 64-bit property handler from a 32-bit application; CoCreateInstance with the flags that are supposed to can't create the class. Nor is there a way to specify difference property handlers for 32bit apps vs. 64bit apps that I'm aware of. Only option would be to install 32bit Office instead.






    Here's some more different ways to use the control...

    -As a thumbnail list:


    -In pairs to create different layouts (see Note about path changing in this setup below):



    Custom font, tiled background, and no border.


    Ratings stars, subsetted groups, custom foreground and background colors


    Automatically populated Special Folders submenu for the Bookmarks menu.



    Notes

    Multiple Controls
    You can have more than one ucShellBrowse on a form. If you want to have them linked, like one with the directory dropdown only, then place one with files only elsewhere on the form, you'll need to change the path in one when the other changes. It's important in this scenario to have a variable tracking whether you're manually changing the directory, otherwise an infinite loop and crash occurs. Here's how you'd set it up to avoid that:
    Code:
    Private bChanging As Boolean
    
    Private Sub ucShellBrowse1_DirectoryChanged(ByVal sFullPath As String, siItem As oleexp.IShellItem)
    If bChanging = False Then
        bChanging = True
        ucShellBrowse2.BrowserPath = sFullPath
        bChanging = False
    End If
    End Sub
    
    Private Sub ucShellBrowse2_DirectoryChanged(ByVal sFullPath As String, siItem As oleexp.IShellItem)
    If bChanging = False Then
        bChanging = True
        ucShellBrowse1.BrowserPath = sFullPath
        bChanging = False
    End If
    End Sub
    Printing Directory List
    This is a pretty common usage, which is why I added the simple .Files(), .Folders(), etc. But what if you want to output a fancy list:


    This is done in a project form rather than the .ctl. First, add oleexp addons mIID.bas and mPKEY.bas (if copying from here; the demo project in the zip has its own copies of the needed UUIDs/PKEYs). Second, in a module we'll borrow some support code from the control:
    Code:
    Private Declare Function SysReAllocString Lib "oleaut32.dll" (ByVal pBSTR As Long, Optional ByVal pszStrPtr As Long) As Long
    Private Declare Function PSFormatPropertyValue Lib "propsys.dll" (ByVal pps As Long, ByVal ppd As Long, ByVal pdff As PROPDESC_FORMAT_FLAGS, ppszDisplay As Long) As Long
    Private Declare Function PSGetPropertyDescription Lib "propsys.dll" (PropKey As oleexp.PROPERTYKEY, riid As UUID, ppv As Any) As Long
    Public Function LPWSTRtoStr(lPtr As Long, Optional ByVal fFree As Boolean = True) As String
    SysReAllocString VarPtr(LPWSTRtoStr), lPtr
    If fFree Then
        Call CoTaskMemFree(lPtr)
    End If
    End Function
    Public Function GetPropertyKeyDisplayString(pps As IPropertyStore, pkProp As oleexp.PROPERTYKEY, Optional bFixChars As Boolean = True) As String
    'Gets the string value of the given canonical property; e.g. System.Company, System.Rating, etc
    'This would be the value displayed in Explorer if you added the column in details view
    Dim lpsz As Long
    Dim ppd As IPropertyDescription
    PSGetPropertyDescription pkProp, IID_IPropertyDescription, ppd
    If ((pps Is Nothing) = False) And ((ppd Is Nothing) = False) Then
        PSFormatPropertyValue ObjPtr(pps), ObjPtr(ppd), PDFF_DEFAULT, lpsz
        SysReAllocString VarPtr(GetPropertyKeyDisplayString), lpsz
        CoTaskMemFree lpsz
        If bFixChars Then
            GetPropertyKeyDisplayString = Replace$(GetPropertyKeyDisplayString, ChrW$(&H200E), "")
            GetPropertyKeyDisplayString = Replace$(GetPropertyKeyDisplayString, ChrW$(&H200F), "")
            GetPropertyKeyDisplayString = Replace$(GetPropertyKeyDisplayString, ChrW$(&H202A), "")
            GetPropertyKeyDisplayString = Replace$(GetPropertyKeyDisplayString, ChrW$(&H202C), "")
        End If
        Set ppd = Nothing
    Else
        Debug.Print "GetPropertyKeyDisplayString.Error->PropertyStore or PropertyDescription is not set."
        
    End If
    End Function
    Then we get to the code to do it. Before calling this, do Select All (Ctrl+A) manually (since there's no other way in this version to get an array of all items)... then with everything selected:
    Code:
    Private Sub Command3_Click()
    On Error GoTo e0
    
    Dim pArSel As IShellItemArray
    Dim siChild As IShellItem, si2 As IShellItem2
    Dim pst As IPropertyStore
    Dim nItems As Long
    Dim lpsz As Long, sTmp As String
    Dim sOut As String
    Dim dwAtr As SFGAO_Flags
    Dim i As Long
    
    Set pArSel = ucShellBrowse1.SelectedItems
    pArSel.GetCount nItems
    Debug.Print "         Name                  Size          Date Modified     Attributes"
    Debug.Print "---------------------------------------------------------------------------"
    For i = 0 To (nItems - 1)
        pArSel.GetItemAt i, siChild
        If siChild Is Nothing Then
            Debug.Print "No child"
            Exit Sub
        End If
        
        Set si2 = siChild
        siChild.GetAttributes SFGAO_FOLDER, dwAtr
        If (dwAtr And SFGAO_FOLDER) = SFGAO_FOLDER Then
            sOut = "<DIR> "
        Else
            sOut = "      "
        End If
        siChild.GetDisplayName SIGDN_NORMALDISPLAY, lpsz
        sTmp = LPWSTRtoStr(lpsz)
        sOut = sOut & sTmp
        sOut = sOut & Space$(30 - Len(sOut))
        
        si2.GetPropertyStore GPS_OPENSLOWITEM Or GPS_BESTEFFORT, IID_IPropertyStore, pst
        
        sTmp = GetPropertyKeyDisplayString(pst, PKEY_Size)
        sTmp = Space$(13 - Len(sTmp)) & sTmp & "  "
        sOut = sOut & sTmp
            
        sTmp = GetPropertyKeyDisplayString(pst, PKEY_DateModified)
        sTmp = sTmp & Space$(20 - Len(sTmp))
        sOut = sOut & sTmp
            
        sTmp = GetPropertyKeyDisplayString(pst, PKEY_FileAttributes)
        sTmp = "-" & sTmp
        
        sOut = sOut & sTmp
        
        Debug.Print sOut
        Set pst = Nothing
    Next i
    pArSel.GetPropertyStore GPS_BESTEFFORT Or GPS_OPENSLOWITEM, IID_IPropertyStore, pst
    If (pst Is Nothing) = False Then
        sTmp = GetPropertyKeyDisplayString(pst, PKEY_Size)
        Set pst = Nothing
    Else
        sTmp = ""
    End If
    Debug.Print "---------------------------------------------------------------------------"
    Debug.Print "                             " & nItems & " items                 " & sTmp
    Exit Sub
    
    e0:
        Debug.Print "Form1.Command3_Click->Error: " & Err.Description & ", 0x" & Hex$(Err.Number)
    End Sub
    Changing to text output is just a matter of replacing Debug.Print with a write to a text file.



    Localization
    This project contains a large number of English-language strings, which presents a problem for users who speak another language. The code in Version 5.3 was reorganized to make localization as easy as possible: all of the text* is located in two places; near the top of the control in the User Consts section just below the changelog, and in the QueryMenuTip function. Control captions are set from this section as well. So for example, to turn the whole thing French-
    Code:
    'Control captions:
    Private Const scc_Up = "Haut"
    Private Const scc_Back = " Retour"
    Private Const scc_Forward = "Svnt"
    Private Const scc_View = "Vue"
    Private Const scc_Ok = "OK"
    Private Const scc_Cancel = "Annuler"
    Private Const scc_Save = "Enreg."
    Private Const scc_ChCols = "Colonnes"
    Private Const scc_Prv = "Aperçu"
    Private Const scc_Width = "Largeur"
    Private Const scc_PropCol = "Propriétés"
    'These are applied to the controls always; changing the caption in the Properties window has no effect at runtime.
    
    Private Const mn_sMore As String = "Plus..."           'There's no system resource to load localized translations like the other items
    Private Const mn_sLock As String = "Garder memes colonnes" 'on the column menu, so you may change it manually here if you wish
                                                           'Note: The lock item won't appear if columns are locked through the LockColumns property
    Private Const mn_sLW = "Bloquer largeur"
    Private Const mn_sLH = "Bloquer hauteur"
    Private Const mn_sSel = "Selectionner"
    Private Const mnv_sGrpHdr = "Grouper par"
    Private Const mnv_sSortHdr = "Trier par"
    Private Const mnv_sSortAsc = "Ordre croissant"
    Private Const mnv_sSortDsc = "Ordre décroissant"
    Private Const mnv_sli As String = "Grandes Icônes"
    Private Const mnv_sSM = "Petites Icônes"
    Private Const mnv_sLS = "Liste"
    Private Const mnv_sDT = "Détails"
    Private Const mnv_sTV = "Tuiles"
    Private Const mnv_sCT = "Contenu"
    Private Const mnv_sJM = "Vignettes"
    Private Const mnv_sNN = "(aucun)"
    Private Const mnv_sNF = "Nouveau dossier"
    Private Const mnv_sPR = "Propriétés"
    Private Const mnv_sRF = "Rafraîchir"
    Private Const mnv_sSB = "Barre d'état"
    Private Const mnv_sPV = "Volet aperçu"
    Private Const mnv_sDB = "Barre de détails"
    Private Const mnv_sPS = "Collez"
    Private Const mnv_sBK = "Signets"
    Private Const m_def_GroupSubsetLinkText As String = "Plus de fichiers..."
    Private Const m_sColCap As String = "Choisir des colonnes"
    Private Const mn_sBkmAdd = "Ajuter un signet pour dossier"
    Private Const mn_sBkmRem = "Suprimez le signet pour dossier"
    Private Const mn_sBkmClr = "Suprimez tous les signets"
    Private Const mNavToStr = "Naviguez à "
    Private Const mNavToDsk = "le Bureau"
    Private Const mn_sBkmSpc = "Dossiers spécials"
    Private Const sSizeFmt_byte = "0 octets"
    Private Const sSizeFmt_kb = "#,##0 Ko"
    Private Const sSizeFmt_mb = "#,##0.00 Mo"
    Private Const sSizeFmt_gb = "#,##0.00 Go"
    Private Const sSizeFmt_tb = "#,##0.00 To"
    Private Const sSizeFmt_pb = "#,##0.00 Po"
    Private Const mFileStr = "fichier"
    Private Const mFilesStr = "fichiers"
    Private Const mNoFilesSelStr = "Aucun fichier sélectionné."
    Private Const mFileSelStr = "fichier sélectionné."
    Private Const mFilesSelStr = "fichiers sélectionnés."
    Private Const mFolderStr = "dossier"
    Private Const mFoldersStr = "dossiers"
    Private Const mReadyStr = "Préparé."
    Private Const mNoItemsStr = "Aucun élément."
    Private Const mSelFileStr = "Selectionnez le fichier en cours"
    Private Const mLoadPvStr = "Aperçu chargement..."
    Private Const mPvhLoadFail = "Erreur: Chargement d'aperçu a échoué."
    Private Const mPvhNotFoundStr = "Echoué à trouver un prestataire d'aperçu"
    Private Const mShowPvStr = "Montrant l'aperçu pour "
    Private Const mProcExThumbStr = "Traitant les vignettes... Peut-etre un peu lent s'il y a video"
    Private Const mProcThumbStr = "Traitant les vignettes..."
    Private Const mThumbExStatusStr = "Traitant les vignettes pour vidéo... Traité "
    Private Const mThumbStatusStr = "Traitant les vignettes... Traité "
    Private Const mOfStr = " de "
    Private Const mThumbFinishStr = "Fini. %1 vignettes en %2 séconds."
    Private Const mRenameFailStr = "Echoué à renommer le fichier."
    Private Const mNoCheckStr = "Aucun fichiers marqués."
    Private Const mFileCheckStr = "Un fichier marqué."
    Private Const mFilesCheckStr = " fichiers marqués."
    Private Const mEmptyFolderStr = "Ce dossier est vide."
    Private Const mRatingTipStr = "Maintenez le bouton SHIFT et cliquez pour réinitialiser à zéro."
    Since I don't want to make a particular resource file mandatory, I didn't set this up as a string table in one, but you could easily set that up too with everything in one place like this. Did the best I could for the circumstances.
    And please forgive me if I got something wrong in my example, I was nearly fluent but haven't used French in about 13 years now.

    * - The column names in the ListView, and the column data itself, are loaded from Windows, and thus will already appear in whatever the current system language is.


    UPDATE: All three resource options have been updated for Version 6.x. It's critical to update both because of new images and potential bugs with manifest padding and language codes in the previous versions.

    resImagesNoDPI
    In the latest release, DPI scaling is enabled through the dpiAware entry in the manifest in the resource file that is needed for high-quality graphics on buttons and menus. If you do not want that feature enabled, but still want the resource file with all the nice graphics, I'm attaching an identical manifest without dpiAware turned on. It couldn't be included in the main zip because of the attachment size limit. (Note that none of the DPI stuff will effect you in any way, regardless of manifest, if your graphics aren't scaled to something other than 100%).

    resImagesNoMan
    This version contains all of the images, but no manifest file at all, in case you want to generate your own or integrate the images into an existing resource easier.


    ResourceImages
    This is a zip of the image files themselves not in any resource. So you can add them to your own without having to go through a resource file editor. Take care to preserve the names; e.g. ICO_BACK.ico should be added as Custom resource "ICO_BACK". All images must be added as 'Custom' resources; never add them as Icon or Bitmap.
    Attached Files Attached Files

  3. #3
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    105

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Nice start. This is going to be very useful. Some feedback from running your demo:

    1 - The preview pane is slightly larger than the details pane and it covers the top bit of the status bar.

    2 - It would be very nice to be able to drag between the details and preview panes to resize both together in the x-axis.

    3 - The button to the right of the Back button never is fully displayed even if the overall window is dragged to the right. I can't tell what the text in the box is although I can see a check mark displayed in the box.

    4 - When I cycle through large icons, small icons, etc. by the time I get back around to Details the column headers are there but no text is shown except in the first column.
    Last edited by MountainMan; Oct 30th, 2017 at 09:44 AM.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Thanks for the feedback. For #3, you're talking about the View button right (refer to the picture in the main post)... is the option to show the View button enabled, and are you on standard DPI (I haven't checked anything regarding DPI sensitivity yet), and OS version? I'll have to take a more thorough look since as the picture indicates, it appears normally on my system.
    With #4, does refreshing fix the issue? I've had to add a couple refreshes for things like that before, it usually works. If not, does changing directories fix it? Or adding/hiding a column? I'll take a look myself of course but additional feedback always helps.

  5. #5
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    105

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Here is how the form looks like when I first run your sample:

    Name:  PJG-1.png
Views: 2404
Size:  19.9 KB

    and here is what the form looks like when I dragged the bottom right to show more of the form (I also drug the date/time column header to the right to show file date/times):

    Name:  PJG-2.jpg
Views: 2202
Size:  18.2 KB

    I am running Windows 10 and have a scaling factor of 175% set. I'll run this on another machine later where the scaling factor is set to 100% and let you know how it looks.

  6. #6
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,316

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Does this support custom/virtual data sources in any way? That getting file lists not tied to the file system?

    I ask because I have a bunch of data with hashed file names stored on the file system, but with virtual links to those files in a database and custom "file names". I'm thinking about implementing something where users can browse the database of links just like explorer, and I'm curious if your demo would be useful for something like that.

    Thanks!

  7. #7
    Frenzied Member
    Join Date
    Sep 2012
    Posts
    1,598

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    @jpbro:

    I haven't tested fafalone's control, it looks interesting. Maybe the following links are useful to you:

    http://www.planet-source-code.com/vb...65746&lngWId=1
    http://www.planet-source-code.com/vb...66732&lngWId=1
    http://www.planet-source-code.com/vb...67906&lngWId=1
    Last edited by dreammanor; Nov 10th, 2017 at 01:13 PM.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Quote Originally Posted by MountainMan View Post
    Here is how the form looks like when I first run your sample:

    Name:  PJG-1.png
Views: 2404
Size:  19.9 KB

    and here is what the form looks like when I dragged the bottom right to show more of the form (I also drug the date/time column header to the right to show file date/times):

    Name:  PJG-2.jpg
Views: 2202
Size:  18.2 KB

    I am running Windows 10 and have a scaling factor of 175% set. I'll run this on another machine later where the scaling factor is set to 100% and let you know how it looks.
    Ah, definitely a DPI scaling issue then. None of the scaling adjusts for that yet; I'll do it for the next version though, I'm more familiar with it now and it worked out pretty well after making the TaskDialogIndirect project work with different DPI.


    Edit: Regarding the View switching, can you confirm, the only time a problem arises is when Thumbnail view is activated and then switched out of? Thumbview changes the imagelist and item icon indecies, so to fix it I restored those in the switchout. I have no idea why the details weren't showing in the columns, but calling a refresh after the switchout restores them.

    Quote Originally Posted by jpbro View Post
    Does this support custom/virtual data sources in any way? That getting file lists not tied to the file system?

    I ask because I have a bunch of data with hashed file names stored on the file system, but with virtual links to those files in a database and custom "file names". I'm thinking about implementing something where users can browse the database of links just like explorer, and I'm curious if your demo would be useful for something like that.

    Thanks!
    I'm not sure there's anything that would benefit over starting from scratch; there's very little in the project that does any manual file handling, it's all back and forth with the shell. I'm not entirely sure the format you mean though; if you just wanted to replace the file system names with one looked up from a database, that would be easy enough, just a couple lines in the enumerator (and would work out well, since the display name is largely unconnected to anything about the file)... if that's not an accurate picture of what you're doing can you clarify?

  9. #9
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,316

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Hi fafalone,

    Sorry for not getting back to you sooner, I missed your reply.

    Here's a better explanation of my situation.

    I have some called "Projects" and each project has a name (basically a database table).

    Each project can have sections, say "A" to "J".

    Each section can have items (unlimited, identified by a GUID).

    Each item can have attachments (again unlimited, identified by a GUID, a file hash, and with a human readable title).

    Attachments are things like PDF and image files. They are stored on the file system in a series of subfolders based on the first 4 characters of their file hash. A single attachment can be linked to multiple items across multiple sections and projects, but it will only be stored on the file system once and only a link is recorded in the project database.

    So what I would like to do is have a browsable shell/explorer-like interface that let's users pick a project and it will show all of the attachments for that project. Columns might be SECTION, ITEM, TITLE, SIZE, FILETYPE, PHYSICAL LOCATION, HASH. Physical locations can of course then be duplicated across multiple attachments as long as the linked item is different.

    So a file with a hash of ABCDEFGHIJKLMNOP would be stored somewhere C:\ProgramData\MyApp\Attachments\A\B\C\D\ABCDEFGHIJKLMNOP, but it is linked in project A, Section 2, Item QRSTLMN as well as Project A, Section 4, OPQRSTU. I would like to show both entries but customize the text that appears for all column/cells to the friendly human readable forms.

    Would such a thing be possible with your demo? I'm willing to do the work to modify it, just wondering if I should even bother to try.

    Thanks!

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Ok so I think I understand how you would want this to work... you would be able to generate a list of shell locations (full file paths) for the current items attachments, then you just want to display those in the ListView? And since it's a fixed list, you wouldn't need navigation ability right?

    If that's an accurate assessment of the functionality, then to load an arbitrary list of files in different locations like that, I don't think starting with this project would be the best route to go. However, another project of mine, Advanced Thumbnail ListView, could very easily be modified to show such a list-- despite the project being about thumbnails, before thumbnail mode is activated, it loads a file system folder with normal icons that you could change to most of the other views without effort. The enumeration method in that project would be able to be modified to load an arbitrary list instead quite easily, and would be much easier to have a fixed, custom set of details columns (set just like the first column but with the .iSubItem filled in). Then, taking any other Explorer-type functionality you might need could be transplanted from this project (like if you wanted the right-click context menu from Explorer, the preview pane, or the drag and drop features, etc). I really think going that direction would be more efficient than re-doing the loading/navigation/details system in this project, because it's so thoroughly bound to the shell.


    Edit: General Update on 2018-01-17
    Haven't stopped developing this project, it's just very complicated to add the latest set of features... added over 2,000 lines to the project since the first release
    New: Details pane (multi-item, background, read/write strings), Active drag/drop, disable d/d option, browse in Zip, add/remove/update file list in response to shell change notify*, resize preview pane, autotoggle control box at small widths, all reported and several unreported bugfixes
    At this point, the next version is feature-complete; going to hold over detail pane editing for non-string and tree updating (see note below) for a future version.
    All that remains is final testing. Surprisingly no adjustments needed to be made for DPI.
    *-The tree dropdown isn't updated; this would require monitoring the entire filesystem and be much more trouble than it's worth

  11. #11
    Frenzied Member
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,316

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Hi fafalone, thanks for you thoughts on this, I appreciate it! I will give it a try with your Thumbnail view project as soon as I can.

  12. #12

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Post Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    v2 is feature-complete, so I thought I'd post it as a beta release for anyone else interested to test too.


    Test Updates

    Glad I didn't post this as a final...
    -FileDragDropMode Property Let has an error, Detach shouldn't have an argument.
    -Subclassing the edit boxes for properties seems to be stable, so I'm going to go that way after all. That means the Save/Cancel buttons will automatically appear without the need of clicking a picture, when you type a char
    -Since it's subclassed now, going to include the ability to change dates too, popping up a datetime control on click, presuming it saves ok when I get to that part (working with PROPVARIANT is a pain to begin with, VT_FILETIME being unsupported without PropVariantToVariant doubly so; that works for reading it, hopefully I can get it to save). Edit: Confirmed working! Used InitPropVariantFromFileTime.
    -Like the Date Control above, there's also pop-up combobox controls for editable properties that are a list.

    Just getting the list items is crazy:
    Code:
                                If tDispProps(nDispProp).dwDispType = PDDT_ENUMERATED Then
                                    On Error GoTo e1
                                    DebugAppend .szSystemName & " type=0x" & Hex$(tDispProps(nDispProp).dwDispType)
                                    pps.GetValue .pkey, vrp
                                    PropVariantToVariant vrp, vrpvb
                                    DebugAppend "Value=" & CStr(vrpvb)
                                    tDispProps(nDispProp).vEnumeratedValue = vrpvb
                                    DebugAppend "VarType=" & VarType(vrpvb)
                                    If VarType(vrpvb) = vbEmpty Then
                                        tDispProps(nDispProp).vEnumeratedIsEmpty = True
                                    End If
                                        
        '                            GoTo skipenum
                                    Dim ppd As IPropertyDescription
                                    PSGetPropertyDescription .pkey, IID_IPropertyDescription, ppd
                                    Dim pETL As IPropertyEnumTypeList
                                    Dim pET As IPropertyEnumType
                                    Dim nEnumType As PROPENUMTYPE
                                    Dim lpInitIdx As Long
                                    Dim nTCt As Long
                                    Dim vr1 As Variant, vr2 As Variant, vr3 As Variant, vr4 As Variant
                                    Dim vb1 As Variant, vb2 As Variant, vb3 As Variant, vb4 As Variant
                                    Dim lpTemp As Long, sTemp As String, l1 As Long, l2 As Long, s1 As String, s2 As String
                                    ppd.GetEnumTypeList IID_IPropertyEnumTypeList, pETL
                                    If (pETL Is Nothing) = False Then
                                        DebugAppend "Got ETL for " & .szSystemName
                                        pETL.GetCount nTCt
                                        If nTCt > 0 Then
                                        DebugAppend "typect=" & nTCt
                                        ReDim tDispProps(nDispProp).sEnumerated(nTCt - 1)
                                        ReDim tDispProps(nDispProp).vEnumerated(nTCt - 1)
                                        For j = 0 To (nTCt - 1)
                                            pETL.GetAt j, IID_IPropertyEnumType, pET
                                            If (pET Is Nothing) = False Then
                                                 pET.GetEnumType nEnumType
                                                DebugAppend "nEnumType=" & nEnumType
                                                If nEnumType = PET_DEFAULTVALUE Then
                                                    pET.GetDisplayText lpTemp
                                                    DebugAppend "PET_DEFAULTVALUE str=" & LPWSTRtoStr(lpTemp)
                                                End If
                                                If (nEnumType = PET_DISCRETEVALUE) Then
                                                    pET.GetRangeMinValue vr1
                                                    pET.GetRangeSetValue vr2
                                                    PropVariantToVariant vr1, vb1
                                                    PropVariantToVariant vr2, vb2
                                                    DebugAppend "PET_DISCRETEVALUE v1=" & CStr(vb1) & ",v2=" & CStr(vb2)
                                                    pET.GetValue vr3
                                                     
                                                    PropVariantToVariant vr3, vb3
                                                    DebugAppend "PET_DISCRETEVALUE vr3=" & CStr(vb3)
                                                    pET.GetDisplayText lpTemp
                                                    tDispProps(nDispProp).sEnumerated(j) = LPWSTRtoStr(lpTemp)
                                                    tDispProps(nDispProp).vEnumerated(j) = vr3
                                                    DebugAppend "PET_DISCRETEVALUE str=" & tDispProps(nDispProp).sEnumerated(j)
                                                    If tDispProps(nDispProp).vEnumeratedIsEmpty = False Then
                                                        DebugAppend "Comp " & CLng(tDispProps(nDispProp).vEnumeratedValue) & "|" & CLng(vb1)
                                                        If CLng(tDispProps(nDispProp).vEnumeratedValue) = CLng(vb3) Then
                                                            tDispProps(nDispProp).lEnumeratedInitialIndex = j
                                                        End If
                                                    End If
                                                End If
                                                If (nEnumType = PET_RANGEDVALUE) Then
                                                    pET.GetRangeMinValue vr1
                                                    pET.GetRangeSetValue vr2
                                                    PropVariantToVariant vr1, vb1
                                                    PropVariantToVariant vr2, vb2
                                                    DebugAppend "PET_RANGEDVALUE v1=" & CStr(vb1) & ",v2=" & CStr(vb2)
                                                    pET.GetDisplayText lpTemp
                                                    tDispProps(nDispProp).sEnumerated(j) = LPWSTRtoStr(lpTemp)
                                                    If CLng(vb2) = 0& Then
                                                        tDispProps(nDispProp).vEnumerated(j) = vr1
                                                    Else
                                                        tDispProps(nDispProp).vEnumerated(j) = vr2
                                                    End If
                                                    tDispProps(nDispProp).vEnumeratedIsRanged = True
                                                    DebugAppend "PET_RANGEDVALUE str=" & tDispProps(nDispProp).sEnumerated(j)
                                                    If tDispProps(nDispProp).vEnumeratedIsEmpty = False Then
                                                        If CLng(tDispProps(nDispProp).vEnumeratedValue) >= CLng(vb1) Then
                                                            tDispProps(nDispProp).lEnumeratedInitialIndex = j
                                                        End If
                                                    End If
                                                End If
                                                If nEnumType = PET_ENDRANGE Then
                                                    pET.GetValue vr3
                                                    pET.GetRangeMinValue vr4
                                                    PropVariantToVariant vr3, vb3
                                                    PropVariantToVariant vr4, vb4
                                                    DebugAppend "PET_ENDRANGE v3=" & CStr(vb3) & ",v4=" & CStr(vb4)
                                                    tDispProps(nDispProp).vEnumeratedEndRange = vr3
                                                End If
                                            End If
                                        Next j
                                    Else
                                        DebugAppend "typect=0"
                                    End If
                                End If
                            End If
    Update (Jan31)
    Removed beta; full release imminent. Sorry for the delay but I just couldn't resist finishing up the property editing. All that's left is running through everything to check for bugs.

  13. #13

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    ucShellBrowse Version 2 has been released.


    New Key Features
    -Explorer-style Details Pane: It pulls the same list of 'preview properties' to display at the bottom, which vary by file type. For some file types, Explorer lets you edit certain properties-- this project does as well, including popping up date and combo controls. The number of properties that can fit are adjusted based on size. Rows can add with vertical height but it's not sizable at runtime yet (UPDATE: Now is in latest version). As a finishing touch, the "edit invitation" cue banner for blank but editable fields is also included (e.g. "Add tag").

    -Dynamic Drag Drop: As you drag over items in the list, folders and zip files are highlighted as you drag over them, and can be dropped on directly. This can be done fully internally as well.

    -Directory Updates: The control monitors the current directory for files added, deleted, or updated, and then updates the ListView.

    -Sizable Preview Pane: Per request, this is now sizable. Right click the frame caption to select 'Lock width' to determine which control is changed on horizontal resize. (UPDATE: Draggable size bar now present in latest version; Lock width disables it)

    -A number of minor features have also been added, as well as a host of bug fixes. See the full changelog below (or in ucShellBrowse.ctl) for details.

    A couple more shots of the new detail panes editing ability, popup controls like Explorer:




    Here's the full changelog:
    Code:
    '------------------------------CHANGELOG------------------------------
    'v2
    '-The Details Pane is now available. It displays what Explorer would. Editing
    ' values is supported, now for all types (string, number, datetime, list) except
    ' boolean, which does not appear to be used (if you find where it is, let me know)
    '-Added active drag/drop: folders (and zip files) are highlighted as items are
    ' dragged over them, and can be dropped on directly
    '-Active drag/drop allows internal drag/drop as well
    '-Added option to disable drag, drop, or both
    '-Added option to browse inside zip/cab files (on by default)
    '-Current folder is monitored for changes (new item, deletion, update). On by default
    '-A splitter bar was impractically complex, but you can now have either the ListView
    ' or the Preview frame size horizontally-- right click the "Preview" text in the frame
    ' to set the 'Lock width' option
    '-If the control box is on (Back,Up,View) and the width gets so small the directory
    ' dropdown would disappear, the control box is automatically switched off, then restored
    ' when the width becomes wide enough again
    '-Added option LockNavigation that prevents the user from changing directories. The path
    ' can still be changed in code with .BrowserPath.
    '(Bug fix) Switching from thumbnail view to other views resulted in loss of icons
    '          and/or detail column text
    '(Bug fix) Command box buttons were cut off in different DPI
    '(Bug fix) Combo overlapped top of ListView with different DPI
    '(Bug fix) Preview pane and ListView height for different DPI
    '(Bug fix) View button icon was different in Win10; now just stored internally
    '(Bug fix) Navigation couldn't handle certain functionality in the Fonts folder
    '(Bug fix) Crash occured after mouseover of shell context menu seperators with id -1
    '(Bug fix) Clicks/double clicks on statusbar were interpreted as clicks on the ListView,
    '          click events changed to verify origin hWnd now
    '(Bug fix) At certain control widths a background image holder control was mistakenly visible
    '(Bug fix) If multiselect was enabled and your selection drag finished outside an item, item 0
    '          was set as the focused item (main selection) even if it wasn't selected. If that
    '          happens now, the first item in the multiselect group (or the real selected item when
    '          it's the only selected item) is reported as the single selection result
    '(Bug fix) If you clicked on a control box button (Back,Up,View) then clicked on the ListView again,
    '          keystrokes were sent to the buttons instead of the ListView
    '==============================
    I checked it on high DPI (simulated on a Win8 VM with scale 150%) and everything seems to render and size correctly, which was a little surprising for the details pane since there's loads of manual pixel count calculations... so if there's an issue let me know (and if you want to play with it yourself remember the current scale factors are stored in m_ScaleX/m_ScaleY).

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Arrow ucShellBrowse Version 3 Beta Release

    ucShellBrowse v3 - Beta Version

    Version 3 of ucShellBrowse includes a few new features and some critical bug fixes. There's now standard resizing (which can be toggled on/off) between the ListView and the optional Preview/Detail panes. Also, there was a ControlType option listed, but no other modes were implemented. Now they are, and a 'Drives Only' mode has been added; this finalizes being a complete replacement for the VB (Drive|Dir|File)ListBox controls.

    It is entering the final testing phase, and posting it makes sense since I'm particularly concerned about DPI on different peoples systems, as there's a number of changes to sizing routines revolving around finally just making the Preview Pane and Details Pane be resizable via a traditional drag bar between them and the ListView. Please report any bugs relating to that or anything else.

    Full Change Log:
    Code:
    'v3
    '-Alternate modes for ControlType are now available; control can be Directory Only,
    ' Drives Only, or Files Only, showing only the combo or ListView, in addition to the
    ' normal mode of dir+files with both controls.
    '-Detail Pane can now be sized with a bar; this also includes correctly scaling
    ' the icons. The height is 70 by default.
    '-The Preview Pane now also uses a resize bar.
    '-The Lock Width|Height menus for the panes are still present, and now serve to remove
    ' the sizing bars. Both sizing bars are active by default.
    '-Panes are now redrawn automatically when resized
    '-Property columns on the Details Pane will now be widened if there's room.
    '-Automatically make a single column match the listview width on startup
    '-(Bug fix) After dropping on a folder or zip file, the hilite didn't clear when
    '           another item was clicked or it was deselected
    '-(Bug fix) Dropping on libraries wasn't working; now works for both background and
    '           dynamic dragdrop
    '-(Bug fix) When on the Desktop, any file created/deleted anywhere was added/removed
    '           from the list
    '-(Bug fix) The column right-click menu default properties (name,size,etc) were hard
    '           coded instead of using the language of the system; now only the 'More..'
    '           item remains non-localized.


    UPDATE

    FIX RELEASED
    Both this version and the previous version of ucShellBrowse contain the code (ppcp.IsPropertyWritable(VarPtr(.pkey)) <> S_OK), but the current release version of oleexp.tlb has this as a Sub (and it cannot work that way). I don't understand why no one seems to have encountered this error before this beta.
    It also fixes the two similar typelib-version based errors Steve pointed out below. Apologies for forgetting the version difference.

    UPDATE 2
    I've finalized oleexp v4.4, please upgrade in order to use the latest version of ucShellBrowse.

    (Version 3 has been officially released, so the beta version has been removed. Thanks everyone who tried it out early!)

  15. #15
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    463

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Hi fafalone, I always enjoy testing your stuff but this latest demo (V3) has me beat!

    No problems with references (4.3 is used), but ran into;

    Getsystemmetrics remarked out
    SM_CXICON not declared
    ppcp.IsPropertyWritable(VarPtr(.pkey) Byref argument type mismatch

    Win 10 64 16299.309 VB6 Pro SP6.

  16. #16

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Sorry about that, the first two I forgot to define in module; the next version of oleexp.tlb has them defined in the typelib.

    .IsPropertyWritable on the other hand, I thought was similar but has me thoroughly confused. That line has not changed since the previous version, and it's a show-stopping error, but it's not come up before? The details pane is on in V2 by default and as soon as you click a file that error pops up. Only thing I can think of is no one ran the V2r1 Demo project and never turned it on in their projects. Was this the case for you (assuming you used the prev. version at all)?

    Going to have to investigate this further... in the mean time, I'm putting a copy of the latest dev build of oleexp.tlb in the zip; there's no changes to existing interfaces besides the .IsPropertyWritable, so it's safe to replace. See below.

    Update
    There's no getting around needing that to be a function; I've finalized and released oleexp.tlb 4.4, so that's going to have to be updated to use v3 (and apparently v2).

  17. #17
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    463

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    This is my first time with ucShellBrowse. However if you would like me to test the earlier versions I will.

  18. #18

  19. #19

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Version 3 Officially Released!

    Everything appears to be ok on high DPI systems from my testing, and that was the final delay. A number of features have been added since the initial beta, so you'll want to grab the new release even if you downloaded that.

    The biggest changes are a Bookmarks button, new control modes (the ones that were listed but weren't implemented, along with a new 'Drives Only' mode), draggable sizer bars for the preview and details panes, and a checkboxes option. Beyond that there's lots of little features, improvements, and bug fixes-- definitely worth upgrading.
    Here's the full list of changes:
    Code:
    'v3
    'NOTE: If you had moved the functions from mSBSubclass, be advised this version adds
    '      one more wndproc, DthWndProc.
    '-Added an optional Bookmarks button in the control box (hidden by default). Note that
    ' the entries are stored in the system registry, under ucShellBrowse (UserControl.Name)
    ' in the VB programs section. See the variable in the section just below this readme to
    ' set the max number of entries (initial default = 48)
    '-Alternate modes for ControlType are now available; control can be Directory Only,
    ' Drives Only, or Files Only, showing only the combo or ListView, in addition to the
    ' normal mode of dir+files with both controls.
    '-Added option to select files by using checkboxes (off by default).
    '-Detail Pane can now be sized with a bar; this also includes correctly scaling
    ' the icons. The height is 70 by default.
    '-The Preview Pane now also uses a resize bar.
    '-The Lock Width|Height menus for the panes are still present, and now serve to remove
    ' the sizing bars. Both sizing bars are active by default.
    '-Panes are now redrawn automatically when resized
    '-Property columns on the Details Pane will now be widened if there's room.
    '-Automatically make a single column match the listview width on startup
    '-Added SelectedFile/SelectedFiles property get/let to retrieve just the filename, and
    ' the let allows changing the selected item(s) to the given name(s)
    ' NOTE: Since Property Lets cannot accept an array directly, SelectedFiles uses a
    '       Variant to hold the (string) array (applies to the Get as well since they must
    '       use the same type).
    '-Added some additional UserControl event forwards (mouse actions, these only apply to
    ' the small background areas of the UC, not the controls on it)
    '-Added ItemAdded/ItemRemoved event for changes in the currently displayed folder (does
    ' not fire during the location changing)
    '-Added FileDetailsWrite event for when file metadata is written from the Details Pane
    '-Added StatusMessage event that fires when the control updates its status message
    '-Added Files() and Folders() function to get a list of *all* files/folders instead of
    ' just the selected ones, also FilesFullParsing/FoldersFullParsing to supply a list of
    ' full paths/filenames with the absolute names (SIGDN_DESKTOPABSOLUTEPARSING). Whether
    ' ZIP files are counted as files or folders is controlled by whether the BrowseZip option
    ' is enabled or not-- if it's treated as a folder it's counted as one.
    '-Added additional sizing restrictions to prevent elements from being sized to 0
    '-(Bug fix) The file name caption in the Details Pane used a standard label, so could
    '           not display Unicode. It has been replaced with an API-created label to allow
    '           tbat. Additionally, the label uses the system default caption font.
    '-(Bug fix) After dropping on a folder or zip file, the hilite didn't clear when
    '           another item was clicked or it was deselected
    '-(Bug fix) Dropping on libraries wasn't working; now works for both background and
    '           dynamic dragdrop
    '-(Bug fix) When on the Desktop, any file created/deleted anywhere was added/removed
    '           from the list
    '-(Bug fix) The column right-click menu default properties (name,size,etc) were hard
    '           coded instead of using the language of the system; now only the 'More..'
    '           item remains non-localized.
    '-(Bug fix) The Preview Pane may have overlapped the Details Pane when the height was
    '           below a certain point.
    '-(Bug fix) When changing control properties in the IDE, the PreviewPane property would
    '           get stuck in the True position.
    '-(Bug fix) When changing the ListControlBox property, the path combobox didn't adjust
    '           to not overlap it. It now does in both design time and run time.


    And to look ahead, it's not in this version since it requires an upgrade to oleexp (or would require a whole other typelib), and I just released one, but...
    Coming soon to a ucShellBrowse near you:

  20. #20
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    105

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Fafalone,

    Your instructions for using the .ctl version says "your project must contain mSBSubclass.bas (from the main folder of the project)" and I don't find that file in either the demo project or in the files for v4.4 of oleexp. Am I missing something?

  21. #21

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    mSBSubclass was in the root folder along with the .ctl.... BUT, there's now a huge update and it's no longer required with the new version.


    Version 4 Has Been Released!

    This is the largest update since the project began, with 23 new or enhanced features and 18 bug fixes, and the control now uses Paul Caton and LaVolpe's self-subclass/self-callback thunks (modified to handle the large proc count) so the subclassing .bas is no longer needed. There's an optional graphics/manifest resource file included: It enables replacing the menu images with higher quality transparent icons (this is automatic, no additional code needed and if the .res isn't present the control falls back to the originals); and also a Common Controls 6 manifest, which you can delete if you've already got one but want the icons. An additional demo project is included that shows minimalist use of the control, similar to the original folder/file list VB controls. Most important for that is the new HideColumnHeader option, which lets you keep the control in Details view so the scrolling is vertical instead of horizontal like the other small icon views, without the big ugly header saying Name.

    IMPORTANT: This version requires an update to oleexp.tlb as well, to version 4.42, released concurrently with this project (April 13th).

    Here's a pic of the new footer, as well as Explorer-style infotips that display different properties as a tooltip, the properties chosen based on filetype (the ones from PKEY_PropList_InfoTip). Also shows the full name if it's wrapped ('...').

    And also, various new features (and a new demo) to make minimalist usage better:

    Your control can be configured to be like the first pic, the second, and everything in between.
    Full list of changes:
    Code:
    'v4
    '(Code/Control) mSBSubclass is no longer needed. All subclassing/callbacks are now
    '               done with Paul Caton/LaVolpe's Self-Subclass/Callback code.
    '               Special thanks to LaVolpe and Victor Bravo VI for helping me on that.
    '
    '-A footer control can now be added to the view. Be advised this is done
    ' using undocumented interfaces and messages; it works as of the latest
    ' version of Windows 10 at the time of this release, and back to Vista.
    '
    ' The calls are FooterCreate, FooterAddButton (to add another one after the initial
    ' set), FooterClearButtons (not possible to remove a single one), and FooterRemove.
    ' It's recommended to use the lParam to store a unique identifier, but both that and
    ' the button index are passed in the FooterButtonClick event that's raised on click.
    ' The number of buttons is limited only by practical space.
    '
    ' You have two options for footer icons:
    ' 1) Create an API ImageList (or IImageList then ObjPtr() to it), and pass an array of
    '    Long with the index for each item as the tButtonIcons argument.
    ' 2) If you have a resource file, add the .ico files to it as a 'CUSTOM' resource, with
    '    a name in quotations, e.g. "ICO_FOOTER1". The icons can be 32bit alpha icons or any
    '    other ICO file type. The control will then create the ImageList itsself... pass 0&
    '    as the value of hImageList, then pass a String array with the resource name for each
    '    item as the argument for tButtonIcons.
    ' See the Demo project for code showing both approaches.
    '
    '-Hovering over an item now shows an InfoTip like Explorer; a multiline tooltip with the
    ' full file name (only if the label is truncated), then several properties depending on
    ' file type and whether the property is blank or not.
    '
    '-The columns are more like Explorer several ways; in special folders, like Computer,
    ' Fonts, and Network, only the limited cols that are shown in Explorer are listed (and are
    ' added to the right-click column menu if there's only a few of them). Columns added
    ' recently are now listed (if available in the current folder).
    '
    '-There's a resource file in the ucShellBrowse folder, resImages.res, that you can add
    ' to the control or to a project with the CTL (the Demo has it now) to make the icons
    ' on the View menu transparent, and add a few more icons. There was no way to do this
    ' without an extra file. If you do not add the resource file, the old icons with the
    ' slightly off-color background are still present and are loaded instead. You can also
    ' use this resource file to add icons for the footer (see above).
    '
    '-Additional options have been added to give you more control over the runtime:
    '  EnablePreview - Show/hide Preview Pane from the View menu (keeps it locked to design
    '                   time setting)
    '  EnableDetails - Same for Details Pane
    '  EnableViewMenu - Toggles whether the View menu pops up for LV background right-click
    '  LockView - Keeps the design-time view (Details, Large Icons, etc) by hiding menu options
    '  HideColumnHeader - Show/hide the column header in Details view.
    '  MinDroppedWidth - Set a minimum width for the ComboBox; useful for simple modes.
    '-Properties to get the major control hWnds also added: hWndCombo and hWndListView
    '
    '-Previews are now centered in the frame instead of in the top left
    '
    '-You can now manually set an image in the Preview Pane, there's subs SetPreviewPicture
    ' and then StdPic, hBitmap, and hIcon.
    '
    '-The width of the preview pane, and height of the details pane, now have a get/let
    '
    '-Tile View now shows 3 details instead of 2; type, size, and date modified
    ' property. The preview height/detail width are Get only; adjust the control itself
    ' to change the other dimension.
    '
    '-The column menu popup (when right-clicking the column header), recently used columns
    ' that have been removed are now listed.
    '
    '-The Status Bar now shows the number of files that are selected.
    '
    '-On the Details Pane, properties can't be edited on a read-only file even if the prop is
    ' normally able to be edited-- in this situation empty properties are no longer displayed.
    '
    '-The items listed in the columns checklist included many that were unsupported in Explorer;
    ' they're now limited to supported columns (i.e. the same set you see in Explorer).
    '
    '-For the 'More...' columns popup frame, it now increases in height if the main ListView
    ' height is large enough. Also, it's no longer clipped by the UserControl being shrunk while
    ' it's visible, it will be on top of the host form (and will be clipped by total form height).
    '
    '-Added shortcut to de-select all items when Escape is pressed (and ListView has focus).
    
    '-Alt+Enter on the ListView will now display properties of the selected items (or the current
    ' folder if nothing is selected).
    '
    '-Shift+Delete has been added as a shortcut to permanently delete files (no Recycle Bin).
    '
    '-Added event for debug message; logging to file will not be added to this control, so
    ' this allows for it to be implemented by the host project.
    '
    '-Back button is now disabled when there's no further previous locations.
    '
    '-The 'Up' button is now disabled when the root is reached (Desktop, or Computer if
    ' using the 'ComputerAsRoot' option).
    '
    '-Extended columns that are dates or numbers are now sorted as such (instead of plain text),
    ' however the number sorting is currently imperfect as it takes the Val() of the text, in
    ' the future this will be changed to compare the raw numbers (not easy to set up).
    '
    '-Added StatusSinglePanel option to only show the first panel of the StatusBar; mainly for
    ' when the control width is small.
    '
    '(Bug fix) If the Details Pane was turned on via code at runtime, it came up blank until
    '          something was clicked. Now, it renders the background view (folder icon+count)
    '
    '(Bug fix) In Tile View mode, if a new file is created and added (i.e. not part of the
    '          list when tile view was activated), including switching dirs, the extra lines
    '          were not displayed.
    '
    '(Bug fix) When new items are added via shell notify, details (column subitems) were not
    '          loaded, despite the fact the normal property enumerator function was called. This
    '          was fixed, oddly enough, by simply calling it twice.
    '
    '(Bug fix) For some reason, if a button in the control box had focus when a new folder was
    '          created, all keys went to the name label... *except* enter... so you'd type a new
    '          name, hit enter, then the View menu would pop up, or the control would navigate to
    '          Up or Back. The new name was still applied when the label edit ended.
    '
    '(Bug fix) Sort Ascending/Sort Descending menu options on the view menu had not yet been
    '          implemented (though clicking the column to change sort direction was).
    '
    '(Bug fix) The initial ViewMode property was stuck on 1 - Details due to that mode entirely
    '          breaking if column initialization didn't run while it was on. I don't understand
    '          why the behavior is different versus loading a new directory while in non-details
    '          mode, and haven't been able to identify a direct fix, so it was locked. But this
    '          version adds an indirect workaround-- temporarily switching to Details, running the
    '          default column init, then switching back before items are added; allowing it to
    '          work as expected. All View Modes, including Tile and Thumbnail, can now be chosen
    '          as the initial view, without breaking the display of any other mode switched into
    '          during runtime.
    '
    '(Bug fix) When 'Keep same columns' option was enabled, only columns present when enabled would
    '          be remembered, forgetting any columns added to the current view afterwards. Now, the
    '          current column set is retained as displayed at the time of the switch.
    '
    '(Bug fix) When adding additional columns from the checklist, if more than one was selected, only
    '          one of the details would be filled in until the folder was refreshed or changed.
    '
    '(Bug fix) On the Details Pane, the mouse cursor no longer changes when over properties that can't
    '          be modified. The text box was still read-only, but this clears up the visual confusion.
    '
    '(Bug fix) 'Computer As Root' mode still loaded the Desktop when you clicked Computer in the combo.
    '
    '(Bug fix) Sorting by date accessed or date created wasn't working.
    '
    '(Bug fix) Sorting by extended columns required 2 clicks because the column index lagged one behind.
    '
    '(Bug fix) File name colors (blue for compressed, green for encrypted) stopped working sometime
    '          between version 1 and this one.
    '
    '(Bug fix) Renaming files in response to shell notifications deleted and re-added, resulting in the
    '          property fields turning blank. Now there's a proper rename that just updates the item, so
    '          the properties stay filled.
    '
    '(Bug fix) The control uses a few common types, like RECT, POINT, and SIZE, that are defined in
    ' (code)   oleexp.tlb. If these were publicly defined in your project, the priority would be higher
    '          and you'd get Type Mismatch errors. The generic types have been explicitly changed to
    '          'As oleexp.RECT' etc. A private type wouldn't have worked without more trouble; can't
    '          pass them to tlb interfaces. Less common types and APIs were also preemptively changed
    '          to explicit calls just to prevent potential conflicts; e.g. API is different or takes
    '          an oleexp type; these would error if conflicted with a Public Declare.
    '
    '(Bug fix) Setting the mode to Files Only then changing it back to Dir+Files caused ListControlBox
    '          to get switched off and stick a little.
    '
    '(Bug fix) In Dir Only or Drives Only mode, there was an artifact from the Status Bar if it was enabled,
    '          and since that's the default, it's now hidden in those modes regardless of ShowStatusBar.
    '
    '(Bug fix) In Files Only mode, the top of the ListView was not the top of the control, resulting in the
    '          status bar being overlapped if it was visible, and the blank space at the top of the control.

  22. #22
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    105

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    First demo won't compile. Error "User-defined type not defined" on line 434 in ucShellBrowse.ctl. The offending line is:

    Code:
    Private pLVF As IListViewFooter
    Second demo won't compile either. Error is "Variable not defined" with MAX_PATH being highlighted in line 1503 of ucShellBrowse.ctl:

    Code:
      szDisplayName As String * MAX_PATH
    I know what MAX_PATH is but somewhere your demo is expecting to find it in the code you posted but it isn't there...

  23. #23

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    The new version requires an update to oleexp (to version 4.42, just released for this) because of the interface needed for the footer bar. It was in another tlb but I merged it into oleexp so as to not add an additional tlb depend. I noted it in the first post but I'll add it to the release post as well, sorry for not making that more clear.

    But I'm not sure why MAX_PATH would be undefined; that's been included in oleexp for a long time now (since 2015's v3.2), and the line in question has been present and unchanged since the very first release of ucShellBrowse (along with many other instances of it, always relying on the tlb). If it's still an issue after 4.42 let me know; I'll try to figure it out... I did test compile on my native Win7 and the Win8 VM that's a clean test platform with just the files posted, without any such issue.

  24. #24
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    105

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    I have previously downloaded v4.4 and the demos did not compile. I have now downloaded v4.42 and everything works well. Thank you.

  25. #25

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    ucShellBrowse v4.1 has been released

    This is a minor update that has important fixes for Unicode support. Also, the dependency on mscomctl.ocx (Microsoft Windows Common Controls) has been removed, as the 2 controls that were using it are also done entirely in API now. The lag surrounding selecting/deselecting large numbers of items has also been addressed.

    Code:
    'v4 Rev 1
    '
    '(Code/Control) The reference to Windows Common Controls 6.0 (MSCOMCTL.OCX) has been
    '               removed. They were used for the StatusBar and Column Selection list;
    '               these are now created entirely with API. This leaves oleexp as the
    '               only outside dependency.
    '
    '-Removed delays when selecting/deselecting large numbers of items. Each change was
    ' being rendered to the Details Pane, which could cause several seconds of visible
    ' refreshing. Now, when an item changes, a timer is set, so that any more items
    ' selected in the next few milliseconds is included in a single update. See the
    ' nSelUpdateMillisecs constant in the section below these comments to adjust.
    '
    '-When a new folder is loaded, focus is now automatically set to the files list.
    '
    '-Added option to hide labels (file names). This doesn't impact any operations, just
    ' display. Useful for e.g. just showing thumbnails without filenames in the way.
    '
    '(Bug fix) Rename-in-place did not support renaming files with extended Unicode
    '          characters; after also adding support to valid name checking from paste
    '          and several more issues, it's now fully supported-- you can rename and
    '          type, paste, delete, etc, with the full set of characters.
    '
    '(Bug fix) When Details Pane fields were saved, Unicode characters were replaced with
    '          question marks. This effects v4 but not v3/v2.
    '
    '(Bug fix) Sometimes when files are pasted, if they have a custom icon (like a .exe
    '          or .ico), only the generic file icon was shown.

  26. #26

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Version 4.2 Released

    Nobody noticed the rather severe bug that the directory dropdown was not changing??? I'm so sorry I didn't notice it earlier; put in a last minute change to try to speed usage by setting focus after loading a new directory, and for some inexplicable reason VB insists on waiting for all code to run, even with doevents, and then changing it, which for some reason the focus change prevents.
    (If you want to just fix this yourself in the current version, at the end of LVLoadFolder, comment out the two lines SetFocus UserControl.hwnd and SetFocus hLVS)

    But anyway, there's a couple other new features that were ready too. Browsing is now able to handle the Recycle Bin and Recent Places (the latter needing special handling). Details Pane shows icon/info correctly in ZIP/CAB now.

  27. #27

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Resolved Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Version 5.0 Released

    This is a major update with tons of new features.
    Some of the highlights:
    • Custom folders: You can specify a list of files from anywhere on the system and display them together in a single folder.
    • Graphics options: You can now add a background image (in a position or tiled), change the background color, change the foreground (font) color, and change the font.
    • Groups can now be collapsed and subsetted.
    • High DPI scaling is now supported.


    The release zip contains 4 different demo projects:
    \Demo - The standard project demo, with the color changes shown above (you can change them back in the regular design mode on Form1)
    \Demo2 - Minimalist options that mimic the original VB Directory and Files control.
    \Demo3 - The two-control setup pictured in post #2 where you use two different ucShellBrowse controls for an alternative layout.
    \DemoEx - Full-sized browser setup working with ucShellTree. NOTE: Requires ucShellTree which is downloaded separately - Get it here, then put \ucShellTree next to \ucShellBrowse



    Custom font, tiled background, and no border.


    Ratings stars, subsetted groups, custom foreground and background colors


    Automatically populated Special Folders submenu for the Bookmarks menu.

    Version 5.0 Changelog
    Code:
    'v5 (Released 16 Nov 2018)
    '-Can display a custom set of files from anywhere on the system. Call the method
    ' CreateCustomFolder with a list of full paths and other options. Shell context
    ' menus won't work with multiple files (will execute on focused item), but some
    ' custom handlers have been added, and it works normally for a single file.
    ' nIcon can be left as 0 for a standard folder icon, -1 for a search folder icon,
    ' or any icon index in the system imagelist.
    '
    '-Control now fully supports high DPI scaling. This requires the dpiAware=True
    ' value in the manifest. The default manifest, resImages.res, includes that
    ' setting, but if you want to disable it, resImages-NoDpiAware.res is identical
    ' except for that setting, and can be readily swapped into this project instead.
    '
    '-If the 'Rating' column is loaded in Details View, either as a default column
    ' or selected from the column list, the rating will now appear as a series of
    ' stars that you can manipulate just like Explorer. Fully supports groups.
    ' NOTE: This requires the PNG_RT* images in the resource file.
    '
    '-Additional checks were added before renaming files. This catches errors not
    ' caught by watching keys, like reserved filenames, invalid filenames made of
    ' valid characters, and overall path being too long.
    '
    '-Some virtual folders, like Network Connections for example, have a custom set of
    ' columns that are not part of the regular property system, so previously could
    ' not be loaded. They're now viewable through some custom handling.
    ' This routine also exposes custom columns in virtual folders like 'Network' where
    ' prior versions could only show the columns that were standard.
    '
    '-Added a 'Special folders' submenu on the Bookmarks menu containing a number of
    ' common special folders. You can adjust/add/remove the ones you want in the
    ' GenerateSpecialFolderMenu/GetSpecialFolderMenuItem methods. Virtual folders are
    ' supported.
    '
    '-Added the Bookmarks menu to the View Menu when showed from a folder background
    ' right click. This is still controlled by the Bookmark Button property, so the
    ' submenu is only added if the button is (or would be) visible. This allows the use
    ' of bookmarks without the List Control Box or in Files Only Mode.
    '
    '-The font for the ListView/Combo/Status can now be changed. (Borrowed from Krool's
    ' ListView. Thanks!)
    '
    '-Added CustomColor event, which allows you to set a custom font color and background
    ' color on an individual item and subitem basis. The file index and file name are sent,
    ' along with the column index and the system name of the property it's displaying --
    ' e.g. if the 1st column after the name is size, SubItemIndex=1 and SubItemProp="System.Size"
    '
    '-Better support for drag-out of virtual objects that can have shortcuts created.
    '
    '-Added property to control whether sorting is allowed or not.
    '
    '-Added option to disable Wow64 file system redirection.
    '
    '-Added ExplorerStyle option to toggle visual styles (defaults to Explorer Theme)
    '
    '-Added SnapToGrid option. This only applies in icon / small icon / tile views.
    '
    '-Added HeaderDragDrop option.
    '
    '-Added TrackSelect option (the selected item follows the mouse pointer).
    '
    '-Added BorderStyle select with None, Standard, Thick, and Thicker options for the LV.
    '
    '-Added property SelectedColumn (for runtime only, won't appear in Properties design box).
    '
    '-Added additional methods to get file info: FileCount, FolderCount, FilePathFromPos and
    ' FileItemFromPos (which returns a files IShellItem).
    '
    '-You can now set a background image for the file browser ListView. There are 3 sources
    ' supported: A normal VB picture you can set in the UserControl Properties box, a Sub
    ' to directly pass an HBITMAP, and a Sub to pass a URL.
    ' PictureAlignment and PictureWatermark options are present and apply to all three image
    ' sources. Special thanks to Krool, the Picture option was adapted from his ListView
    '
    '-Added BackColor property, added ForeColor property for the main item text, and also
    ' ForeColorSubitem for the subitems when using Details View (Report Mode).
    '
    '-Added experimental Extended Tiles view mode. The layout is similar to Explorer's Content
    ' view, but I don't know how to use columns other than the ones that Detail View had.
    ' This option is disabled by default. If you want to try it, go down to the User Consts section
    ' immediately after these comments and change bHideContentViewMenuItem to True.
    '
    '-Added 'Enabled' option to enable/disable everything on the control.
    '
    '-Groups can now be subsetted: Only a certain number of items are shown with a link at the
    ' bottom to show more. Set the count with GroupSubsetCount and the text of the link with
    ' GroupSubsetLinkText. It defaults to no subsetting and there's default text of "Show more items"
    '
    '-Groups are now collapsible. Added GroupStartCollapsed option to set them collapsed by default.
    '
    '-Misc. adjustments to the Details Pane layout to support different DPI scaling and make better
    ' use of the space to avoid unneeded truncations.
    '
    '-When you click on a text field you can edit in the Details Pane, the textbox background will now
    ' turn white like it does in Explorer, and back to transparent when out of focus. This is to make
    ' it more clear that an edit is in progress.
    '
    '-Checkboxes can now be toggled during runtime, and there's a FileCheck event when checked/unchecked.
    ' Also, added FilesChecked() method to get list of checked items, and FileGetCheck and FileSetCheck to
    ' toggle checkmarks by name.
    '
    '-(Bug fix) View Menu and Bookmarks Menu did not work on Windows 10 due to missing FOLDERID_ values.
    '
    '-(Bug fix) Some internal file data was not being updated after a rename, which
    '           caused failures in the shell context menu commands.
    '
    '-(Bug fix) There were a number of circumstances where actions on virtual objects,
    '           usually in virtual folders, failed. Most of these have been corrected
    '           thanks to the methods developed for the virtual folder custom colsets.
    '
    '-(Bug fix) 'New folder' and 'Paste' commands are now disabled in the menu when in
    '           folders where they will not work.
    '
    '-(Bug fix) Corrected some spacing issues in the Details Pane when DPI scaling is on.
    '
    '-(Bug fix) In Files Only mode, the ListControlBox would slight reappear if the control
    '           was resized to a small width then resized back. This was related to the
    '           feature to auto-hide it; the control didn't check the mode so always restored.
    '
    '-(Bug fix) If the UserControl was not placed in the top left of the form, the column
    '           select popup would appear in the wrong place. The reason was that the only
    '           way I could get it to appear on top of everything was to set its parent
    '           as UserControl.ContainerHwnd; no other method including SWP HWND_TOP worked.
    '           So it was being placed relative to the form, instead of to the UC. Fixed.
    '
    '-(Bug fix) Some virtual locations, like Network Connections, were not showing the help text
    '           (for the status bar) with the right-click menu; these folders seem to not support
    '           the IContextMenu2 interface that was used. But the text only needs the base
    '           IContextMenu, so that was made into a module-level var as well used in 2's place.
    '
    '-(Bug fix) When Group Mode was active and the folder changed, sometimes the group item count
    '           was not updated or displayed the wrong number.
    New Events
    CustomColor(ItemIndex, ItemName, SubItemIndex, SubItemProp, rgbFore, rgbBack) Item position and filename, the column number, and the system property name-- e.g. System.Size. Set rgbFore and/or rgbBack as desired, leave unchanged to stay with the current defaults.
    FileCheck(Index, sFile, fCheck) When Checkboxes are enabled and there's a change. fCheck = 0 for unchecked, fCheck = 1 for checked. File position and full path are sent.


    New Methods

    CreateCustomFolder(Title, Files(), Icon) View files from around the system together. Specify full paths for file list. If Icon is -1, the Saved Search system folder icon is used. If 0, a plain folder icon. If >0, specifies system imagelist index.
    FileCount Returns the number of non-folders.
    FolderCount Returns the number of folders.
    FilePathFromPos Returns the full path of the zero-based position of entries.
    FileItemFromPos Same, but returns an IShellItem.
    PictureSetByHBITMAP Specify an HBITMAP instead of picking the Picture property normally.
    PictureSetByURL Same, by URL.
    FilesChecked() Returns a list of the full paths of checked items.
    FileGetCheck(FileName) Get check status by filename.
    FileSetCheck(FileName) Set check status by filename.

    New Properties
    Enabled
    Font
    AllowSorting
    DisableWow64Redirect
    ExplorerStyle
    SnapToGrid
    HeaderDragDrop
    TrackSelect
    BorderStyle
    SelectedColumn
    Picture, PictureAlignment, PictureWatermark
    ForeColor, BackColor, ForeColorSubitem
    GroupSubsetCount, GroupSubsetLinkText
    GroupStartCollapsed

  28. #28

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Version 5.1 Released
    Jump to download



    This new version brings a number of new and improved features and some important bug fixes.

    Highlights:
    • Percent full bar graph in Computer (technically, any folder/items with the System.PercentFull propertykey will now render like this, but I've never seen it used elsewhere)
    • Option for graphical Back button
    • All icons now support high DPI
    • If you change columns displayed, they're remembered if you go back to the folder


    -The demo project lineup is the same as the 5.0 release, details in the post immediately above this one. Small change in that cLog is included and DemoEx logs debug output of compiled exe.

    -The standard resImages resource file is significantly smaller after removing unused icons and 128/256 pixel icon sizes used only in 16x16 spots.

    Here's the full list of changes:
    Code:
    '-For high-DPI scaling, the control will now attempt to load the Control Box icons
    ' from the resource file, which contains icons with multiple resolutions for scale.
    '
    '-The menu icons, when available in the resource file, now also scale to DPI. The
    ' backup icons from picture boxes remain available for projects without the .res
    '--Additionally, numerous positioning adjustments were made to make item positions
    '  consistent with the standard appearance when running in high DPI.
    '
    '-In the Computer folder, the Percent Full (Space Used) is now displayed as a
    ' progress bar like in Explorer instead of just the number. Details View, Tile View,
    ' and Contents View are supported.
    '
    '-In Details View, the column set will be remembered when the folder is refreshed
    ' or navigated to again after leaving.
    '
    '-Added option to use an Explorer-style round back button on the left of the combo,
    ' or a new option to hide the back button entirely (Backbutton Property).
    '
    '-Added FileGetProperty function to retrieve properties.
    '
    '-Added HeaderNoSizing option to prevent header resize.
    '
    '-Added ControlBackColor option.
    '
    '-When Checkbox mode is enabled, a checkbox now appears in the 'Name' column
    ' header that allows you to check/uncheck all items.
    '
    '-Changes to the Control Box are applied during design-time as well.
    '
    '-Added SortItems event with column, direction, and property sorted by.
    '
    '-Added HighlightColumn[ByProperty] methods to change the background of a given column;
    ' the above SortItems event was added with highlighting the sort column in mind, but
    ' it can be used in any other way as well. NOTE: This uses undocumented interfaces and
    ' calls; it was working on Win7-10 as of release but be wary of future issues.
    '
    '-The main Libraries folder is now expanded by default in the directory dropdown.
    '
    '-Added EnableShellMenu option to control whether the right-click Explorer context menu shows.
    '
    '-The ListView border style can now be immediately changed during both design-time and runtime.
    '
    '-Added FoldersOnly option that controls whether files are listed in the main view area, as
    ' opposed to the dropdown (this option does not effect the dropdown).
    '
    '-In the Details Pane, fields that can be edited are now highlighted with a border during
    ' mouseover (and while editing).
    '
    '-(Design mode) Control Type changes are now applied in design time without close/reopen.
    '               But it is not possible to change the control type at runtime.
    '
    '-(Bug fix) If the Bookmarks Button was enabled, but the View Button wasn't, the
    '           Bookmark Button wasn't positioned right and would not show up.
    '
    '-(Bug fix) The Bookmarks Menu icons were not DPI scaled.
    '
    '-(Bug fix) The stars for the Rating column were mistakenly drawn after the column
    '           was removed in a directory change.
    '
    '-(Bug fix) The status message containing the selection count, while in Checkbox
    '           mode, was only updated after a normal select action instead of the
    '           checkbox toggle.
    '
    '-(Bug fix) The AllowSorting option couldn't be turned off during runtime.
    '
    '-(Bug fix) When you double-click a folder, the '1 file selected' didn't clear after
    '           the new location was opened, therefore incorrectly indicating that a file
    '           was still selected.
    '
    '-(Bug fix) Checkboxes were being handled as if they were the selection; this was
    '           causing issues with previews, details, and some other areas. 'Selected'
    '           now always refers to just the highlight, and 'Checked' is an entirely
    '           different thing.
    '
    '-(Bug fix) Some registered preview handlers fail to load. This situation is often
    '           fixed by trying different arguments in CoCreateInstance; all 3 ways are
    '           now attempted before giving up.


    Special thanks to Charles P.V. for his ucListView control, from which I adapted the subitem progress control.

    Download up top

  29. #29
    Lively Member
    Join Date
    Feb 2015
    Location
    Colorado USA
    Posts
    105

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Fafalone,

    I am having trouble with your demos. In the first one there is a reference to:

    ResFile32="..\resImagesNoMan.RES"

    but there is no such file in the package.

    Also, the projects in Demo2 and Demo3 do not have any references to resource files and do not have manifests but they do have a reference to v5 of the common controls so they have no visual styles. Was that intentional?

  30. #30

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Damn I specifically checked to make sure the demos were referencing the right resource files... no idea how that changed, I went through every one to check it referenced resImagesStd. You can swap it for the .res that is included; that reference is an alternate version without a manifest (see here in post 2), or redownload it after I update it in a second. Sorry about that.

    For 2 and 3; yeah I had left out a manifest and resource on purpose, to demonstrate the simplest usage of the control. The reference (which is actually to 6) should have been removed; nothing from either ocx is used in the control or any demo.

    Edit (23 Dec 2018): Project Updated. Fixed the reference in Demo, removed unneeded mscomctllib reference in Demo2 and Demo3. I had added a FollowLinks option to open folder links inside the browser, so updated the main control while I was at it.

    Edit (11 Jan 2019): Project updated to Version 5.12. There was previously no 'Files Only' mode where folders could be hidden from the main file view. This is a fairly egregious oversight that warranted an immediate update instead of waiting for the next full version increment. There's also a few other improvements:
    -Custom filter for when ItemFilter isn't enough; raises the FilterFile event.
    -Bug fix for Drives Only mode where changing to a non-root path loaded the folders.
    -Bug fix for the PercentFull progress bars; they only appeared in Tile Mode if you switched to it while in the Computer folder; also they're now blue instead of green:
    The ProgressBars for the Computer folder are drawn using the Theme API, rather than actually creating a progress control, and unlike an actual progress control, the Theme API for progress bars allows the blue that you see in Explorer.

  31. #31

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Version 5.2 Released

    This version adds new combo box styles - both dropdown list (all modes where its visible) and simple combo (for dir only/drive only). In addition, it can be enabled/disabled for typing, and when typed into can be used for navigation. The ListView Header has some improvements too, the FilterBar can now be shown, and has built-in filtering and optional manual override, and can now be shown in all views for that filtering or just because. The Column Select list is no longer stuck; you can now resize it and drag it around.
    Then for those odd folks wanting to use this without a CC6 manifest, you can now switch views during runtime and thumbnail mode actually works semi-well now.
    Finally there's some positioning adjustments and a few bug fixes, included the unloading issue that was up in Known Issues for a while.
    Here's the full changelog:
    Code:
    '-Added ComboType option to make the directory dropdown appear as the DropdownList
    ' style instead or, if in DrivesOnly or DirOnly mode, a simple combobox.
    '
    '-Added ComboCanEdit option, which allows (except in ComboType=DropdownList) you to
    ' edit the combo text. Double-clicking will set it to the full path of the current
    ' folder, and pressing enter will navigate to the given location- specify a full path
    ' or the name of a folder in the currently displayed location.
    ' This is accompanied by the ValidateTextNav event, if you wanted to set shortcuts
    ' or otherwise adjust/replace the text entered into the box when enter is pressed.
    '
    '-Added FilterBar option to show filter bars in the column headers. The filter is
    ' matched by default as follows: If a wildcard (*) is present, the comparison uses
    ' VB's Like statement; otherwise, it's matched char by char from the left, e.g. ab
    ' would match abc.txt, but not cabc.txt.
    '--FilterCaseSensitive option was also added to control case sensitivity for the filter.
    '--Event FilterBarOverride was added to allow for custom handling/more complex filters.
    '  The filter text, column text, and filename are provided. Set fShow to 1 for a match,
    '  0 for no match, and do not set it at all if you are not using this feature.
    '--This feature is compatible with Group View: If Group View is not enabled, it creates
    '  a single group with the matches. If Group View is enabled, it simply removes items
    '  that don't match from their groups.
    '--Also included is the FilterBarApplyManually public sub, so that a filter bar action
    '  can be executed without even having to enable the filter bar.
    '
    '-Added HeaderInAllViews option, which if enabled shows column headers in the other
    ' view modes besides Details. The FilterBar can be used in this scenario.
    '
    '-The Details list of all properties to show (Column menu->More...) can now be moved
    ' around and resized.
    '
    '-Default column width is now pegged to m_ScaleX (DPI zoom).
    '-Folder dropdown height is now pegged to m_ScaleY.
    '
    '-Made various positioning updates to Details Pane.
    '
    '-Added rudimentry support for thumbnails without Common Controls 6. The images won't
    ' appear nearly as nice, as semi-transparent pixels stay black, but fully transparent
    ' pixels use masking to change them to the background color.
    '
    '-It is now possible to switch view modes at runtime without Common Controls 6. This
    ' isn't possible by default, so the entire ListView is destroyed and recreated in the
    ' new view. Details are still supported, but tile view, content view, and group view
    ' modes are still all unavailable.
    '--Unsupported modes are no longer shown on the View Menu, and automatically switched
    '  to Large Icon view if set during design-time.
    '
    '-(Bug fix) If the control was on a secondary form, unloading that form did not unload
    '           the control, and it stayed loaded in the background until the whole program
    '           ended. Thanks to dz32 and Eduardo- for figuring out the solution.
    '
    '-(Bug fix) Ratings stars were not rendering if the ListView was scrolled horizontally.
    '
    '-(Bug fix) The global variable containing the current path was updated in .BrowserPath
    '           before the location was validated; this could lead to various problems with
    '           interacting with files in the current view after entering an invalid path.
    '
    '-(Bug fix) The Details Pane and Preview Pane were still visible if enabled when the
    '           control type lacked a file view (DirOnly/DrivesOnly).
    '
    '**NOTE** This control is nearing feature-complete. I expect the next update will be to
    '         finalize things; massively clean up the code, remove all unused methods, pare
    '         down debug output and switch off by default...
    '         SO... If there's any features you'd like to see in this control, or ucShellTree
    '         which will be finalized at the same time... now would be a great time to drop by
    '         the thread or e-mail me!




    To repeat the note, any ideas for additional functionality, let's hear 'em soon, it's time to set this as feature-complete and clean it up.

  32. #32
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    424

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    This is a great control. I am using it.
    I know that you plan to improve it. That is why I would like to bring to your attention a number of changes that would be nice to have:

    1. In the current version of ucShellBrowse, the user can type or paste anything in the combobox on the top-left where the user navigates through the folders.
    That kind of input should be disallowed, because that combobox is not a real address bar. It implements a tree structure somewhat similar to the left panel of Windows Explorer.
    It is not similar to the address bar of the Windows Explorer.
    So, the fact that the user can type (or paste) things in there (and then press Carriage Return and nothing happens) is confusing.

    2. The navigation buttons look very different from Windows Explorer.
    Also, in the current version of ucShellBrowse, there is no Forward button:
    https://i.imgur.com/XVYkBga.jpg
    It would be good to have a forward button as well, and also it would be nice for these navigation buttons to look the same as what they look in Windows Explorer.

    3. In the current version of ucShellBrowse, the Status bar as a whole (as well as its partitions (I guess it consists of two partitions)) have a very dim (almost invisible) border line:
    https://i.imgur.com/XmUxCrn.jpg
    It would be nice if the Status bar (as a whole) and also the vertical divider line(s) inside it, could be made very visible and conspicuous.

    Just my humble opinion.

    Thanks.
    Ilia

  33. #33

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    1) The ComboBox is in fact also an address bar, from version 5.2:
    Code:
    '-Added ComboCanEdit option, which allows (except in ComboType=DropdownList) you to
    ' edit the combo text. Double-clicking will set it to the full path of the current
    ' folder, and pressing enter will navigate to the given location- specify a full path
    ' or the name of a folder in the currently displayed location.
    ' This is accompanied by the ValidateTextNav event, if you wanted to set shortcuts
    ' or otherwise adjust/replace the text entered into the box when enter is pressed.
    2) The Back arrow can be drawn with actual Explorer theme; the 'BackButton' property can be used to switch to that one if you prefer; set it to SBBK_ThemeButton.
    Will definitely work on a forward button at some point; I keep getting a headache when thinking about all the scenarios to track to not lose place going back and forward while opening new folders in between lol.

    3) Not sure what can really be done about that... adding the WS_BORDER style adds a border at the top, but not the bottom. I'm going to add an option to add a border around the whole control; not sure if that's an acceptable solution for this though. The divider line, can't do anything about that short of custom drawing the whole thing.
    One possibility might be putting a line control under it; will see if I can make that look decent. Edit: Even setting the statusbar to bottommost, it draws on top of the line. You'd have to put this on your form rather than in the control itself.

  34. #34
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    424

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    A number of little problems:

    1. There is a problem with de-selecting a file.
    I have some code that shows the name of the selected file in a textbox, when I click on a file, the ucShellBrowse1_SelectionChanged event is fired and my code in there shows the file path in the textbox.
    But, then I click on the white space between the file thumbnails, and that event does not get fired.
    And there isn't any other way to blank out that textbox if the user de-selects a file.
    I have tested with any of the following:
    Code:
    Private Sub ucShellBrowse1_SelectionChanged(arFullPaths() As String, sFocusedItem As String, siFocused As oleexp.IShellItem)
       If ucShellBrowse1.SelCount = 0 Then
          txtFileSelected.Text = ""
       Else
          txtFileSelected.Text = ucShellBrowse1.SelectedFile
       End If
    End Sub
    Or:
    Code:
    Private Sub ucShellBrowse1_SelectionChanged(arFullPaths() As String, sFocusedItem As String, siFocused As oleexp.IShellItem)
       If UBound(arFullPaths) - LBound(arFullPaths) + 1 = 0 Then
          txtFileSelected.Text = ""
       Else
          txtFileSelected.Text = arFullPaths(0)
       End If
    End Sub
    And the problem with de-selecting a file happens in both cases.

    2. Also, when I was experimenting with this control and did some selecting and de-selecting files several times, suddenly a strange message showed up:
    https://i.imgur.com/58G8J1j.jpg
    Why did that message show up?
    How to avoid it?

    3. Another thing that caught my attention is that that message that showed up for an unknown reason (the above screen print), is not a hard message (unlike a VB6 MsgBox).
    I can click on the form itself, and that message goes BEHIND my application!!!
    This could pose some problems and confusions.
    If a message is to pop up, it needs to be a HARD message on the screen (just like a VB6 MsgBox)

    4. If I set a breakpoint inside that event (ucShellBrowse1_SelectionChanged), I see that when I select a file, that event is fired two times. Sometimes three times.
    Is this normal?

    5. And last thing: If the user double-clicks on a file (or selects a file and presses Carriage Return), nothing happens.
    There is a FileClick event, but there isn't a FileDoubleClick event.
    Currently I have a "Process File" commandButton. The user can select a file and then click on that "Process File" commandButton to process the file that he has selected.
    What I need to do is to let the user double-click a file (or alternatively, select a file and press Carriage Return) and that file would be processed.
    How can I do that?

    Please advise.
    Thanks.

  35. #35

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    1) I can add an event like SelectionCleared

    2) That message comes up when you start a drag and then drop it within the view (but not on a folder or other droptarget). I'll take a look at ways to suppress it.

    3) If I can find a way to suppress it that should do the trick; the message originates from Windows though, not the program, so that's why the placement is like that.

    4) There's only one single RaiseEvent statement in the entire control for that event; I'll have to see if I can reproduce that issue.

    5) The FileExecute event fires on both double-click and return.

    I'm going to have to push next release back a day or two, forgot how much work it is to add another navigation button. I'm adding the forward button and the navigation menu dropdown to display a menu containing the nav history.

  36. #36
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    424

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    #1. In the case of de-selecting a file there are actually two different solutions that come to my mind:
    A) Maybe a SelectionCleared event is right as you suggested.
    In that case probably the name of that event had better be FileSelectionCleared instead of SelectionCleared (I will explain why below)

    B) But, maybe the existing SelectionChanged event can also be tweaked.
    In that case when the SelectionChanged event is fired (as a result of deselecting a file), the array arFullPaths() will need to be empty and ucShellBrowse1.SelCount will need to be zero, so that any of the two code snippets in post #34 would work (checking whether the value of ucShellBrowse1.SelCount is zero or checking whether the length of the array arFullPaths() is zero)
    Not sure which one of the above two approaches A or B is best.

    #2 & #3. I think ucShellBrowse needs a property called AllowDragAndDrop.
    And when this property is True, the user can drag and drop, and when it is false, any drag and drop is suppressed.

    And last thing is about the name of that event "SelectionChanged".
    Honestly, I believe the name of that event should be FileSelectionChanged instead of SelectionChanged
    Why? Because there is another event called DirectoryChanged.
    How come the name of that other event DirectoryChanged explicitly specifies it is the Directory that has changed, but the name of SelectionChanged event does not explicitly specify what exactly it is that has changed?
    We know it is a File that has changed, but the two names are not consistent.
    So, I believe for the reason of consistency (and only for consistency), the event SelectionChanged had better be renamed to FileSelectionChanged
    Also, if you choose to implement that SelectionCleared event, the name had better be FileSelectionCleared instead of SelectionCleared (Only for the reason of consistency)

    Just my humble opinion

    Thanks.
    Ilia
    Last edited by IliaPreston; Feb 18th, 2019 at 04:20 AM.

  37. #37
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    424

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    I keep experimenting with this control (ucShellBrowse) and if you don't mind, I share my viewpoints and comments.
    Hopefully my comments could be helpful.

    #6. Currently ucShellBrowse does not provide any possibility for the focus to be set back to a specific file after some user action sets focus to some other control on the screen.
    For example: I can click on a file in ucShellBrowse.
    That single click selects (highlights) that file. (There will be a light blue rim around the file's thumbnail)
    I can now use the arrow keys to freely navigate to other files.
    But, if I press Carriage Return, the following code is invoked:
    Code:
    Private Sub ucShellBrowse1_FileExecute(ByVal sFile As String, siFile As oleexp.IShellItem)
       Call cmdFileProcess_Click
    End Sub
    And then, the focus on the file that was processed is lost. (That light blue rim is now gray instead of light blue, which means that that file is not ACTIVELY selected)
    If I want to select that same file again (for the purpose of using arrow keys to navigate to the next file), I cannot set the focus back to that file in the procedure "ucShellBrowse1_FileExecute"
    There is no such thing as ucShellBrowse1.SetFocus or ucShellBrowse1.SetFileFocus
    So, the user needs to click on that thumbnail again to access it.

    This means that a smooth cycle of ArrowKey then Process then ArrowKey then Process, etc. is not currently possible.

    The above means that something like a ucShellBrowse1.SetFileFocus or some other way of programmically setting the focus back to that file is needed.

    #7. The exact same thing is needed in the very beginning when ucShellBrowse loads the contents of a folder, or when the DirectoryChanged event is fired.
    The programmer needs a way to set focus to the first thumbnail that ucShellBrowse shows, so that the user won't have to do a click to select the first file.

    8. When I set BackButton = SBBK_ThemeButton, the back button looks like what it does in Windows Explorer, but the "Up" button continues to look the way it does.
    It does not follow the setting in the BackButton property, and there is no UpButton property either.
    So, when BackButton = SBBK_ThemeButtonm the two buttons' appearances are very different and inconsistent.
    Also, in that case (BackButton = SBBK_ThemeButton) the back button moves to the left of the address bar, which doesn't look very good.
    It would be nice if the Up button would also look like the Up button in Windows Explorer.
    And it would be nice if the Up button would reside next to the Back (and forward) buttons.
    All three buttons should be to the right of the address bar, because the address bar should be left aligned with the main body of the ucShellBrowse that contains files.

    Thanks
    Last edited by IliaPreston; Feb 18th, 2019 at 05:20 AM.

  38. #38

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    1) Probably best to do both I would think.

    2/3) This option already exists. FileDragDropMode has 4 options: Disabled, Drag Only, Drop Only, and DragDrop

    'FileSelectionChange' would imply that the selection change involves a file, but folders are displayed in the ListView as well. One event is for within the ListView, the other is for what location is displayed there. Would really like to avoid breaking backwards compatibility if at all possible; so would suggest that you can rename the event uptop then run a replace for RaiseEvent SelectionChanged,

    6) You must be doing something to lose the focus... or maybe what OS are you on? For me I can run code in ucShellBrowse_FileExecute without losing keyboard focus.
    In any case, I added a SetFocusOnFiles method that sets focus on the ListView hWnd, should that should take care of it (I'll also add one for the combobox).
    For a heads up, Tab-based navigation is not possible. It can be done if it's only just the ListView, but the IOleInPlaceActiveObject hack doesn't work when there's multiple subcontrols on the UC.

    7) I'm not sure it's appropriate to select a file the user hasn't picked. Recommend doing this manually instead.
    In your Form_Activate event (to cover the initial load), and in the ucShellBrowse_DirectoryChanged event, you can do the following:
    Code:
    Dim sF() As String
    sF = ucShellBrowse1.Files()
    If sF(0) <> "" Then ucShellBrowse1.SelectedFile = sF(0)
    ucShellBrowse1.SetFocusOnFiles
    Note: SetFocusOnFiles is one of the updates I'm working on now, it's not in the release yet; just showing you how you'll do it when the update comes.

    8) There is no themed 'Up' navbutton in the Theme API, at least that's documented. Will take a look. Maybe I could at least turn the other buttons into a tool bar; that would look slightly better.
    As far as alignment goes, I had went with the standard in Explorer and ComDlg and web browsers for the most part... can probably make an option out of it.

  39. #39
    Hyperactive Member
    Join Date
    Mar 2010
    Posts
    424

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Quote Originally Posted by fafalone View Post
    ......
    6) You must be doing something to lose the focus... or maybe what OS are you on? For me I can run code in ucShellBrowse_FileExecute without losing keyboard focus.
    In any case, I added a SetFocusOnFiles method that sets focus on the ListView hWnd, should that should take care of it (I'll also add one for the combobox).
    For a heads up, Tab-based navigation is not possible. It can be done if it's only just the ListView, but the IOleInPlaceActiveObject hack doesn't work when there's multiple subcontrols on the UC.
    ......
    I am using Windows 10 (64bit) on my desktop computer.
    Here is the actual code:
    Code:
    Private Sub ucShellBrowse1_FileExecute(ByVal sFile As String, siFile As oleexp.IShellItem)
       Call cmdFileProcess_Click
    End Sub
    
    Private Sub cmdFileProcess_Click()
       MsgBox "Selected item:  " & ucShellBrowse1.SelectedFile, vbOKOnly, "Process"
    End Sub
    I run the process, then I manually select the first file.
    Now, (because the file is SELECTED) I can easily navigate to other files using arrow keys. I do so. I use arrow keys to navigate to another file. It looks like this:
    https://i.imgur.com/4avLo4y.jpg
    Then I press Carriage Return. The above code is invoked, and a messagebox is shown on the screen. It looks like this:
    https://i.imgur.com/ls4thJe.jpg
    Then I press spacebar to close the messagebox and end the process. It looks like this:
    https://i.imgur.com/mHFW93X.jpg
    As you see, at this point the file has a gray rim, and I cannot use arrow keys to navigate to another file until I manually click on that file or manually click on another file to set focus to it.

    8) There is no themed 'Up' navbutton in the Theme API, at least that's documented. Will take a look. Maybe I could at least turn the other buttons into a tool bar; that would look slightly better.
    As far as alignment goes, I had went with the standard in Explorer and ComDlg and web browsers for the most part... can probably make an option out of it.
    All I am saying is that it would be quite good if it would look like this mock-up:
    https://i.imgur.com/BOakYZd.jpg
    Not that it is very important. Just, it would be nice.

    My humble opinion.

    Thanks.
    Ilia

  40. #40

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,289

    Re: [VB6] ucShellBrowse: A modern replacement for Drive/FileList w/ extensive feature

    Yeah the messagebox is taking away the focus. The new call I put it will restore the gray to blue.

    Without a themed up arrow available from the Theme API, there's going to be the issue of either having the up arrow stored as a static image and therefore not matching on different Windows versions, or storing all of them statically, so they'd match eachother but not Windows except for whatever version I grab the images from. So I'm kind of inclined towards just leaving it as the standard icon that the common dialogs use.

    There's a whole lot of code changes involving anything to do with that top row; there's tons of complexity around sizing based on what's showing/hidden, and calculating when to autohide, etc. So it's not as simple as just dragging a control over in the IDE.
    BUT... I had a couple hours to kill, so now there's additionally a SBNB_ThemeBtnInBox option that places the back/forward buttons in between the combobox and the up arrow.
    So currently like this:



    Edit: You had earlier asked about the SelectedFile type functions; it turns out there already are all the permutations you could want...
    .SelectedFilePath = full path of selected file, e.g. C:\dir1\file.txt
    .SelectedFile = just the name, e.g. file.txt
    .SelectedFilesPaths() = array of selected file full paths like above
    .SelectedFiles() = array of just selected file names

    Also, can't find any time when .SelCount isn't accurate.


    So as of right now, the last outstanding issue is what to do about the 'Up', 'View', and 'Bookmarks' button. Probably leaning towards a toolbar; if I did that, you'd be able to replace the icon with your own without it looking too different since text would be optional.

    Update (March 1st)
    It's funny that I included a comment about almost being feature complete. Then Mr. Preston there came along, and then a bunch of other new features were requested and I thought of a bunch more on top of that. I've been busily working on adding a whole bunch more stuff, that's why the update isn't out yet.
    Here's a preview of the changes added so far:
    (Removed. Final changelog is posted below in the update announcement; no need for a confusing partial one here.)

    But now I *think* I've got everything, except for changing the control command buttons to a toolbar. Hopefully this weekend.

Page 1 of 2 12 LastLast

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
  •  



Featured


Click Here to Expand Forum to Full Width