Page 4 of 5 FirstFirst 12345 LastLast
Results 121 to 160 of 172

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

  1. #121

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

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

    Project Updated to Version 8.4

    I noticed a lot of room for improvement when looking at the sorting in the previous version. First, a major bug had gone unnoticed: Sorting by default columns (size, type, and date created/accessed/modified) did not work at all in Libraries and some other special folders.
    Decided to entirely overhaul the sorting system after that. See the changelog below for details, but the important takeaway is that bug is fixed, extended columns with formatted numbers and dates are now sorted correctly as they're no longer treated as plain strings, and the new method dramatically boosts performance. Sorting large folders is now up to a whopping 600% faster, and this applies to all columns, default and extended. Also items inserted after the folder is loaded had a number of sort issues corrected.

    Code:
    'New in v8.4 (Released 17 Sep 2020)
    '
    '-The sorting methods have been completely overhauled. All sorting is now done
    ' via built-in algorithms unless disabled. Specifically:
    '
    '    -Sorting performance for all columns has been dramatically improved. All of the
    '     column data is now cached in the main information structure for each item when
    '     the folder is first loaded, eliminating several API calls to find the item in
    '     the list then read the text from the column display.
    '     This improved sorting speed by 200-600% in tests; the more items, the bigger
    '     the improvement. Sorting 3,000 items went from 950ms to 170ms.
    '
    '   -(Bug fix) Sorting by default columns was broken in Libraries and some other
    '       special folders. IShellFolder.CompareIDs, which was being used, is
    '       now being disabled entirely unless you set AlwaysSortWithISF to True.
    '       Otherwise, the new routine for extended columns is used on all of the
    '       columns. This performs 200-500% better.
    '
    '   -(Bug fix) All extended columns were treated as strings by the sort algorithm.
    '       This resulted in numbers that were formatted to partial text not
    '       sorted- such as the Free Space column in This PC, which is displayed
    '       as e.g. 502 GB. This would just be treated as a plain 502, which
    '       might be smaller than 1.0 TB, which would be 1.
    '       The new system records the raw number before formatting (in our
    '       example, the value in bytes), and uses that in the sort algo.
    '
    '    -(Bug fix) For extended columns sorted by text, the ascending/descending arrow
    '       in the column header didn't match whether the column was currently
    '       sorted that way (it indicated the opposite).
    '
    '    -(Bug fix) There were some issues with how items added after the folder loaded
    '       were sorted.
    '
    '-Added user option bScrollToSelectedAfterSort.
    '
    '-The StatusText property appeared in the design-time Properties window, but
    ' setting it there neither showed the message or saved it. That property has
    ' now been hidden from the Properties window- you can of course still read and
    ' write it during runtime. In its place is a new StatusTextStart property, that
    ' will display a message in the Status Bar when the control first loads.

  2. #122

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

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

    Project Update: Version 8.4 R2
    High-priority Bug Fixes

    The right-click shell context menu was not returning the correct command ids for numerous items, making it take a different action than the menu item indicates. This affects 3rd party additions to the menu, and a couple non-default built in options, but not Properties/Copy/Cut/Rename/Delete. By playing around with the options, this bug seems to have been corrected, but if you encounter any situation where the menu item and action don't match, please let me know.
    This fix also results in a number of icons for 3rd party entries showing where they weren't before, and the Send To submenu having significantly more options, also showing icons that were missing.
    Further, made the extended verbs like 'Open command window here' an option: AlwaysShowExtendedVerbs. If False, they are only shown when the Shift key is pressed when the click occurs, which is how it works in Explorer.

    Additionally, almost none of the UUID variables were explicitly typed (they were all As UUID instead of As oleexp.UUID). This results in a situation where the program won't run if there's a Public Type UUID anywhere in the project, or another TLB that's a higher priority than oleexp. While it's uncommon and trivial to fix, this is something that should have been fixed a long time ago. While I was at it, I went ahead and eliminated all non-explicit types defined in the TLB, so there's no further possibility on conflicts.
    Note: There's also an update to ucShellTree with this same bug fix for that project.

    Also added a Copy Path menu entry.

    (Note: The project was re-uploaded on the 22nd, but that was just to turn off printing debug info to the Immediate window; set dbg_PrintToImmediate to False, and making the menu tip for the Browse shell context menu item appear in the status bar, so I didn't update the version since it's simple enough to toggle that yourself)

    Code:
    'New in v8.4 R2 (Released 19 Sep 2020)
    '
    '-Added a 'Copy path' item to the View menu, which copies the full path of the
    ' current location to the clipboard. Can be disabled with bDisableCopyPathMenuItem
    ' User Option. Copies the parsing path, so ::{GUID} paths for virtual locations.
    '
    '-Added option AlwaysShowExtendedVerbs for the Shell Context Menu. If set to False,
    ' certain extended verbs like 'Open command window here' will only appear on the
    ' Shell Context Menu (right-clicking on an item) when Shift is pressed, which is
    ' how it works in Explorer.
    '
    '-(Bug fix) A large number of commands in the Shell Context menu (displayed when
    '           right clicking an item) did not execute the right command. This is a
    '           very strange bug, as there's no reason it should be reporting the wrong
    '           item ID. I've found a fix that seems to have largely eliminated this
    '           issue, but please let me know if it pops up with your extensions.
    '           This change also allows some 3rd party shell extension icons to appear
    '           which were previously not loading, and has additional items on the
    '           Send To submenu, which now also shows previously missing icons.
    '
    '-(Bug fix) Most instances of UUID variables were not explicitly typed (they were
    '           'As UUID' instead of 'As oleexp.UUID'). The result is show stopping
    '           errors if anywhere in the project there was a Public Type UUID.
    '           Additionally, I've gone ahead and replaced *all* non-explicit types
    '           that were defined in oleexp, to eliminate any possible conflicts.
    '
    '-(Bug fix) The menu tip for the 'Browse' command on the shell context menu had
    '           not been added.

  3. #123

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

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

    Version 8.5 Beta


    The upcoming version has 2 complex new features (and a few smaller ones), and a ton of bug fixes, so I'm posting it as a Beta here first; both because the bug fixes are numerous and a few very important, and to see if anyone runs across an issue with the new features.

    First, it's now possible to fully replicate the VB DirListBox. Previously, if you wanted a parent tree, you had to use the separate dropdown. I've added a new feature that, in Details Mode without groups, you can have a parent tree right in the list with the ShowParentTreeInList option:
    Name:  sbasdb.jpg
Views: 599
Size:  32.3 KB
    There's a new demo, DemoVBDir, that shows how to configure the control to get the above appearance (ShowParentTreeInList, ControlType=FilesOnly, DefaultColumns blank and LockColumns=SBCL_LockNoAuto so only the name column is present and no new ones load, HideColumnHeader, FoldersOnly, ViewMode = SB_VIEW_DETAILS).
    A key improvement over the VB version is that when you navigate to the root drive, it will load the rest of Computer so you're able to get to other drives with just the one control.

    The other big feature is now the Columns popup reflects the actual order of the columns, and you can configure the order right there in the popup:
    Name:  sbcolorder.jpg
Views: 591
Size:  39.8 KB


    Here's a full list of changes:
    Code:
    'New in v8.5 (Beta Release: 12 October 2020)
    '
    '  Beta Rolling Changes 
    '(14 Oct 5:50PM)
    '   -Previously, Directory Only modes followed the standard loading procedure of not
    '    adding items under the dropdown unless they were opened. Now, if the mode is
    '    Directory Only or Directory Only With Controls, selecting a folder will add the
    '    child folders under it.
    '
    '   -(Bug fix) GetValue calls were set as functions when the last release of oleexp
    '              expected a sub.
    '
    '(13 Oct 12:37A):
    '
    '   -Added SelectColumnOnSort to highlight a column when you sort by it.
    '
    '   -The color of the highlight can be set with the new ColumnSelectColor option.
    '
    '   -(Bug fix) The 'Advanced Mode' option was missing from the Column Select dropdown
    '           menu under the Property header.
    '
    'First beta post:
    '-The new ShowParentTreeInList option will, in Details View only (and only if Group
    ' View is disabled), turn the file list into a view similar to a TreeView-- or, the
    ' VB DirListBox. The first item will be the drive root, then each parent below it
    ' indented slightly more, until the current folder, where all items are then listed
    ' at the same level, e.g. :
    ' C:\
    '   vb6
    '     ucShellBrowse
    '       Demo
    '       Demo2
    '       Demo3
    ' and so on. The folders always appear at the top, then the current folder contents
    ' are sorted in their normal order, and this is preserved as you change the sort
    ' column and direction.
    ' The tree, by design, only go to Computer, if the Desktop is root, or the current
    ' drive, if Computer is root. Custom roots will go all the way to the root.
    ' There's also a User Option, bShowParentItemsInAllViews, to add these items to
    ' other views, but they will not be visually distinguished from items in the same
    ' location, so this is disabled by default.
    '
    '-The Column Select popup now reflects the current order of columns, and there's
    ' a new UpDown control that lets you change the order of the columns in the popup,
    ' and the ListView also supports dragging and dropping items to their location; an
    ' insertion mark is displayed between the items you're dropping it in between.
    ' Note that the new order won't be applied until the dialog is closed.
    '
    '-There's now a MinHeightDropdown option. Previously, it was hard coded to just
    ' always be 300 * scale no matter what.
    '
    '-That option pairs with the DropdownFixedHeight option. If this option is set to
    ' zero, the dropdown height is set to the UserControl height. Otherwise, it's set
    ' to the value specified (*scale), or the MinHeightDropdown, whichever is larger.
    ' Note: This cannot be changed at runtime.
    '
    '-Added SpecialFoldersInBookmarks to control whether the submenu full of special
    ' folders like Downloads, Windows, Documents, etc, shows in the Bookmarks Menu;
    ' previously there wasn't even a UserOption for this.
    '
    '-The Bookmarks menu no longer has 'Clear all bookmarks' enabled if no bookmarks
    ' have been created.
    '
    '-(Bug fix) If starting blank and in Details View, some properties were listed in
    '           the Column Select Popup that should be hidden (System.*).
    '           Why that's the case and being unable to fix it takes the cake for the
    '           single most bizarre behavior I've ever seen, but I found a workaround.
    '
    '-(Bug fix) If you specify a custom root, and lock it, the control loads the root
    '           path instead of the initial path in BrowserPath. Additionally, if you
    '           specified a BrowserPath during design time for the initial path, this
    '           resulted in various glitches and improperly adding it to the tree.
    '
    '-(Bug fix) If you specify a custom root, and lock it, attempting to navigate to
    '           a location that's not a child of the root, such as though bookmarks,
    '           special folders, or shortcuts, the path won't load, however, it will
    '           still be added to the dropdown under the root (Root\Computer\path).
    '           Selecting it from the dropdown still wouldn't load the path, but the
    '           item should never be added to the dropdown.
    '
    '-(Bug fix) The preference for Super Hidden items wasn't applied for items added
    '           after the folder is already loaded (in LVAddEntry).
    '
    '-(Bug fix) If you navigated directly from a Search Results folder to a Custom
    '           Folder, the Search Footer would not be removed.
    '
    '-(Bug fix) If you specify a custom root and lock it, Search will not work,
    '           because the Results Folder would not be recognized as a valid child
    '           of the path, since as a virtual object it had no path to compare.
    '           Added manual check and override for both the initial action and
    '           navigating away then re-selecting the results from the dropdown.
    '
    '-(Bug fix) With the above fix, this would have normally also loaded the Search
    '           Footer, which would have the 'Search Again' options. The Search
    '           Footer has been preemptively disabled to prevent loading items
    '           outside the given root, until a method is added to ensure all the
    '           locations are valid children of the root.
    '
    '-(Bug fix) In many circumstances when you sorted, then navigated to a different
    '           location, the sort column wouldn't be cleared, the new location would
    '           by sorted by that column except always processed as text, and the sort
    '           arrow and column highlight wouldn't reset.
    I'll be testing it myself over the next few days, but it seems pretty solid so definitely give it a go if any of these changes are important for you!

    NOTE: Main post on Page #1 is where the beta is posted now; needed to address some bugs in the old version ASAP.

  4. #124
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    I can't get past any of the

    Code:
    hr = pps.GetValue(uColData(lp).pKey, vrw)
    calls. Getvalue is highlighted and all its intellisense works fine. I can see all the members. Oleexp 4.62 is referenced and loaded. If I rem out this one then the next one in the next function will error. HELP!!

  5. #125

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

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

    Fixed.

    I thought I had the current oleexp version in my system folder but apparently I had the wrong one, on both my main computer and the win10 laptop I use for testing. It's declared as a Sub in 4.62 so using it as a function there was causing an error.

    You can grab the new version or just change it to pps.GetValue uColData(lp).pKey, vrw in the 3 places it occurs.

    What's weird is nobody let me know before now and this same issue is present in the main version

    ---
    Also made a major change to Directory Only (and DirOnly w/Ctls); previously, it wouldn't add children to the dropdown when you selected a folder, limiting it to only what's initially loaded if you didn't have it joined with a ListView that showed them. Now, it will expand the selected directory in the dropdown.
    Note: For now, folders added under this rule will appear in reverse alphabetical order, while I work on a way to get them in the right order since everything I've tried so far results in breaking parent/child ordering when higher level folders are loaded.

  6. #126
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    Works fine now Jon, thank you. However, it is still very slow showing the contents of my Music folder (currently 58992 tracks). Is this not the right tool for that job? Am I expecting too much?

    Explorer < 1 sec.
    ucShellBrowse<> 25 secs.

  7. #127

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

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

    Presumably, Explorer recognizes it as a music folder, therefore loads columns that read title and album from the ID3 tags.

    I believe the difference is Explorer is reading them on demand as they come into view, as opposed to my control, which will read the data for all files on load. Should make the initial scroll through more responsive, but obviously takes time.

    Long term Im planning on rewriting things to do things the Explorer way, but it's complete overhaul.

    If you don't need the columns that read the ID3 tags, you can turn off the feature that detects the default column set by setting LockColumns to LockNoAuto (you can load them later through the column select), but if you do want those, right now yeah it's going to be slow to open and read 50k files at once.

    UPDATE:
    So I was able to implement a limited version of the way Explorer only reads data on demand.

    I'm posting an experimental version of the control here that sets callbacks for every column besides Name and Size; this way ID3 tag properties and everything else is not loaded until the first time the file comes into view. As is the case in Explorer, there will be delays the first time you scroll an item into view, but the initial load is *much* faster.

    To compare against the old behavior, you can set ExtendedColumnPreload to True to go back to loading everything first.

    All the basics are working; Details View and Tile View, adding new columns, but there's a lot to validate before making it the main release.
    Except... Sort. I'm completely baffled by this right now. LoadFolder... broke. Refresh, which just calls LoadFolder again... works. There should be no difference, I can't comprehend how there's a difference, or why, or what on earth is possibly going on to cause this... so, no estimate on sort

    UPDATE 2:
    Looks like code was being called out of order... if there were 10 items in the current folder, those 10 would be deleted before navigating to the next folder, but then the control received 10 DISPINFO requests, before any new items were added, throwing off everything. Added a manual flag to ignore DISPINFO requests coming at the wrong times.

    Sorting now works as normal, with the obvious caveat if you attempt to sort by anything besides name, the control will need to read all of the files first to figure out how to sort things. Might be able to adjust to not need to do that for size since it still had to be read in the initial load anyway, but that's a project for another day. As is full virtual mode... but do let me know how this performs, as I don't have that many files with metadata to test on. Tried about 2000 mp3s, which does the initial load in under a second (but it's not expected to be linear; the bulk of the time is reading the first page id3s). Virtual mode may or may not be a major advantage if disk access is the bottleneck here.


    REMOVED-SEE TWO POSTS DOWN FOR NEW VERSION

  8. #128
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    This is still much the same but now taking 18secs. Just so you know I am using DemoVB, so all I see are the filenames and their icon.

    Using FindFirstFileExW I can load all the filenames in the folder in 0.0363 secs but of course I am not trying to find the icon from the shell.

    It is unlikely to be disk access as Windows and my own tests (my tests are not virtual) do it so fast. From what I see, I think explorer gets all the filenames and using the standard music icon (in my case VLC) puts them in the listview. You then see the tags populating in the listview at a slower rate. My files are a 60/40 split Flac/mp3. I hope some of this is useful.

  9. #129

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

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

    Hmm, could indeed be the icon lookups. You're using default settings right, with debug output off? And you mentioned you're loading things with the \DemoVB\ demo project--- that form has 3 instances of the control that are linked to eachother (if one navigates somewhere they all follow), so every time you load a folder in one you're loading directories 3 times in a row. You'll get a better idea of the true speed if you open the folder in a single control only.

    Here's a version that only looks up icons on demand as well, without looking up anything else if it's in List or small icon view.

    If that's not it, then it would have to be the name, type, or size lookups...

    One more idea here, the icons are set in LVSetStdIcon sub, perhaps changing GIL_FORSHELL to GIL_DEFAULTICON would speed things up, but as the name implies, you won't see custom icons for exes, shortcuts, etc.

    NOTE: This version is for testing only; so many features are broken since it's just to test something highly specific.

    EDIT: Removed attachment. See latest experimental release a few posts down.

  10. #130
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    This didn't really make any improvement so I went back to some old controls I've had for at least 20 years from Sky Software. These are WXFLDVW.Ocx and WXFILVW.OCX. Folderview & Fileview respectively. I just popped them both on a form, linked them and then selected my music folder - 8 Secs complete with the correct VLC Icon. This was in IDE compiled it was just over 1 second. No metadata here but then there is none in the tests I have been doing for you. Incidentally the files are shown correctly sorted from the start.

    I have noticed that the filenames in DemoVB are slightly corrupted for a while and not of the correct number when first shown. They then spring into sorted with the correct (I assume) number.

    The linking is just as below in case you were wondering. The ocx's come to 900K in total.

    Code:
    Private Sub Form_Load()
        FolderView1.FileView = FileView1
    End Sub
    Attached Images Attached Images  

  11. #131

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

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

    Well I might be making some progress... it seems both IShellFolder/IEnumIDList and IShellItem/IEnumShellItems have a best case scenario of 15s or so to load 50,000 items, just reading off the names.

    So I made a version that does the initial listing with FindFirstFileEx, which cuts the initial read down to 8-10s... but the problem has become, if you don't use WM_SETREDRAW to turn off redrawing, it will redraw after each item, making it extremely slow (over a minute), but now when I go to turn it back on, the call is taking 15 seconds, making the total around 23-25s.

    But I'm close. Once this redraw issue is solved my control will match the 8-10s time of other FindFirstFile based controls at least.

  12. #132
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    Obviously I don't know your test machine/OS but this is what I get from a freshly started PC (no files in cache) using Win 10 Home 2004/i7 7700K @ 4.2 GHz from a standard 2TB sata hard drive. Compiled.
    To not get bogged down with the slowness of listviews/listboxes I use the McListbox.ctl from Jim Jose from PSC and load the filenames into an array for sorting then dump them into the McListbox thus

    Code:
     lstFiles.AutoRefresh = False
        For j = 0 To UBound(arFiles)
            lstFiles.AddItem arFiles(j)
        Next
        lstFiles.AutoRefresh = True
    I will try dumping directly and come back and edit this. I have to shut down to clear the cache.
    ....Well as you can see dumping direct is a little quicker but the tracks are not sorted.

    Let me know further what, if anything, I can do to help.
    Attached Images Attached Images   
    Last edited by Steve Grant; Oct 22nd, 2020 at 02:44 AM.

  13. #133
    Fanatic Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,013

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

    Check my RecDir class, https://github.com/M2000Interpreter/...ter/RecDir.cls
    I use this for my own control for files. When we see something (a folder's items) and click for any other folder, then a new recdir start to made a internal list, but until that list end we see the "old" list, and maybe we can cancel the first search.
    The multitascking achived because we use the RecDir with events. We get the result by an event.

  14. #134

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

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

    So for another experiment, I switched to an even lower level set of calls for enumerating directories (NtOpenFile/NtQueryDirectoryFile). The main loop does as little as possible, and the issue with redrawing seems to be resolved.

    This is probably going to wind up being the floor... best possible outcome without going to full virtual mode.

    On my system, it's able to load 57,000 items in 13s all in (opening the folder until you can start interacting with the files), and 21,000 files in 3.5s, and 7,500 items in 1.1s.

    In the LVLoadFolder sub, you'll see it redirects to the new routine, LVLoadFolderExB; you can remove that redirect if you want to look at the fully stable and feature-complete best case scenario, but that's clocking in at 21,000 files in 6.6s and 57,000 at 20s.


    Not sure which way I'm going to go for the final release, but this beta shows the two options. Apart from the high performance re-direct, it has all the major updates made for the 9.0 release as well.

    UPDATE:
    Virtual locations can't be loaded with the low level APIs, so the redirect is set to use the regular method for things like Computer/This PC, the Devices and Printers folder, or Libraries, or attached media devices.
    However, I found that the Fonts folder is also unsupported, so added a routine to check for folders that are regular disk locations, but unsupported. Right now that's only Fonts that I've seen, but if you find another, add it to the array in SetUnsupportedHPfLocs and let me know. Also couldn't load Search Results folders or zip files with the low level APIs; group view needs some reworking so if it's enabled when a folder is opened it falls back to the standard method. Implemented options for FoldersOnly/FilesOnly, filters for file names or folder names, and show hidden/show superhidden for the high performance part; it only added 300ms on the 57,000 items so definitely worthwhile.

    UPDATE:
    Group view for folders supported by the high performance routine is now enabled.
    Fixed issue with Contents View
    Fixed issue with loading icons after changing directories in Med/L/XL Icon View

    UPDATE (November 24th):
    This should be the final beta. I've decided to integrate the new high performance method; it will be used under strict conditions for where it's supported (local disks, no virtual locations). For unsupported locations, the routine used is still a much better performer than it used to be (unless you enable column preloading), as it only loads most data on demand.

    The new beta here fixes a whole bunch of bugs related to context menu commands. The keyboard actions for things like Delete weren't working with multiple items, and the right-click menu was all kinds of screwed up for a while now. All this just needs to be tested for virtual locations and media devices, then some general testing, and then I'll be able to finalize. 9.0 will be the best performing, most stable, and most complete version yet. Taking time to get it all right and all tested, so please report any issues with this new beta

    (Edit: Removed Beta after final version release)

  15. #135

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

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

    Project Updated to Version 9.0

    After putting in tons of work refining the high performance changes, I've gone ahead and released it as a major version update. As mentioned, the final version uses the High Performance Mode with low-level APIs where applicable, and the regular, but still new and much better performing, mode for everywhere else. The final compiled version has been loading 60,000 items in 10 seconds flat.


    This is a major update with significant new features. The biggest difference is performance. Previous versions became slow when loading directories with more than a few thousand files. The new version addresses this in 2 ways: First, the regular loading method defers loading most data until an item is scrolled into view for the first time. This creates a little lag when scrolling an item into view for the first time, but speeds up the initial time until you can start interacting with a folder. You can use the old way of loading all data first by changing the new ColumnPreload option to True. Second: Normal folders on local drives are now loaded using a special High Performance Mode. This uses a low-level API to dramatically speed up load times. The trade-off is that it only works, as stated, for normal folders on local drives. Network locations, virtual folders, search results, and a few other exceptions will fall back to the regular loading method (which as just described, is still much faster than the old version). This can be disabled by setting the HighPerformanceMode option to False.

    There's a big change to Directory Only Mode / Directory Only w/ Controls: Previously you'd be stuck on top level folders; now when selecting a location, the directory dropdown will load the child folders, so you can continue navigating. There are some issues with the sort order here, I'm stuck on how to address them for now but it's a fairly minor issue, so I went ahead and included this new feature.

    A number of minor new features and bug fixes rounds out the release; see the full changelog below for full details.
    Code:
    'New in v9.0 (Released 28 Nov 2020)
    '(Includes changes from the public betas)
    '
    '-Added ColumnPreload option. To speed up performance, all columns besides name
    ' will only be loaded the first time an item is scrolled into view. To load them
    ' all first instead, set this option to True. In earlier versions, load time could
    ' go up exponentially; e.g. 7000 items would take ~8s, but 50000 items would take
    ' over 10 minutes (!). This only brings the 7000 item load time down to 4.5s, but
    ' brings the time to allowing interaction with 50000 items down to 15-20s.
    ' NOTE: This is unsupported in certain virtual locations. Libraries are supported,
    '       but e.g. Network Connections is not.
    '       Media devices like phones and cameras are not currently supported.
    '       Unsupported locations will load as if this option was True-- how things
    '       worked in all previous versions.
    '-If not preloading, icons are now set on demand via a callback as well.
    '
    '-Added HighPerformanceMode option. This uses low-level APIs to load folders as
    ' quickly as possible. 5-10,000 items are loaded in under 2s, 60,000 items are able
    ' to be loaded in 10-12s. This method is highly limited in support: only regular
    ' file system locations on local drives are supported. Virtual locations, network
    ' resources, attached media devices, inside zip/cab files, and some special folders
    ' like Fonts are all unsupported. Directory Only/Directory Only + Controls will not
    ' use this mode. If ShowParentTreeInList is True, this mode is not supported. In the
    ' case of an unsupported folder, it falls back to the standard method of loading
    ' folders. The ColumnPreload option must also be False to use this.
    '
    '-Previously, Directory Only modes followed the standard loading procedure of not
    ' adding items under the dropdown unless they were opened. Now, if the mode is
    ' Directory Only or Directory Only With Controls, selecting a folder will add the
    ' child folders under it.
    ' You can change this behavior to be done in other modes, or never, through the
    ' new User Option nExpandSelectedFolderInDropdown.
    ' This feature is still a work in progress. Some folders will appear at the bottom
    ' of the list, while others will appear in the proper place, and opening Libraries
    ' will open included folders from their root, rather than under Libraries. This is
    ' way more complicated than it would seem, so it'll take a while to sort out all of
    ' the kinks, but I didn't want to delay the whole project for weeks or months while
    ' this is ongoing.
    '
    '-You now have the option to specify the column set when creating a Custom Folder.
    ' To use this feature, in the method where you call CreateCustomFolder, create an
    ' array of PROPERTYKEY keys, e.g. apk(), representing the columns you want displayed.
    ' Then when you call CreateCustomFolder, you call it as follows:
    ' ucSB.CreateCustomFolder "Title", Paths(), [Icon], VarPtr(apk(0)), UBound(apk) + 1
    '
    '-Added SelectColumnOnSort to highlight a column when you sort by it.
    '
    '-The color of the highlight can be set with the new ColumnSelectColor option.
    '
    '-Added icon for Status Bar option in the Layout menu.
    '
    '-Added PlaySounds option. If enabled, the system navigation sound plays (if set
    ' in the Control Panel), as well as the default beep / critical stop sounds (these
    ' were already present, but used the Beep command; they now look up the sound that
    ' is set in the Control Panel). If you want to enable/disable these sounds
    ' individually, there's a new value in the User Options section below these comments
    ' for each one. Default is enabled.
    '
    '-The Context Key will now bring up the Shell Context Menu (assuming the option
    ' EnableShellMenu is True).
    '
    '-For the Column Select popup, you can now right click an item to display the menu
    ' with the 'Send to top' option, instead of only being able to access it through the
    ' column header dropdown.
    '
    '-Switching between DirOnly[WithCtl]/DriveOnly during runtime/updating the design
    ' view was not possible since a ListView wasn't being created. These switches now
    ' work in both the IDE and during runtime.
    '
    '-Added the SearchPopupInMenu option, which adds an 'Advanced search' item to the
    ' layout menu to immediately show the Search Options popup. If the SearchBox option
    ' is set to True, and the control bar is hidden, and this option is enabled, just the
    ' 'Advanced search' item is added, since under those settings the two items would be
    ' identical in behavior.
    '
    '-The preview for the last displayed file is now cleared when a new folder is loaded,
    ' instead of staying up until a new file was clicked.
    '
    '-Previewing images is an ongoing challenge. What crops and zooms instead of scales
    ' seems to vary between Windows versions. IShellItemImageFactory shouldn't have been
    ' doing that, and should have returned the same image as IThumbnailProvider, but that
    ' has not been the case.
    ' The new first attempt uses IThumbnailProvider, which maintains aspect ratio as it
    ' displays images less than full size, and will not enlarge past full size. The hope
    ' is this behavior remains consistent with the various Win10 versions; if it doesn't,
    ' please give me a shout.
    '
    '-(Bug fix) A long-standing bug would either add or not add the 'Browse' option
    '           to the Shell Context Menu based on whether the very first item was a
    '           folder, instead of the currently selected item. Clicking it would work
    '           properly, but it shouldn't have been enabled at all.
    '
    '-(Bug fix) For items like in Programs and Features that have URLs as properties,
    '           the links were created but no action was taken when clicked. Now, the
    '           default is to open the URL with the default browser. There's a new
    '           event: ItemLinkClick, which reports the URL, and the fExec argument,
    '           which allows you to override the open action by setting it to anything
    '           other than 0.
    '
    '-(Bug fix) If BrowseZip was set to true, zip files were not being separated from
    '           regular folders in the sort order. Additionally, sometimes regular files
    '           were not getting separated either.
    '
    '-(Bug fix) GetValue calls were set as functions when the last release of oleexp
    '           expected a sub.
    '
    '-(Bug fix) The 'Advanced Mode' option was missing from the Column Select dropdown
    '           menu under the Property header.
    '
    '-(Bug fix) If you switched the Control Type from Dir+Files to FilesOnly during
    '           runtime, and then back to Dir+Files, the Preview Pane would have its top
    '           aligned with the top of the control instead of the top of the ListView.
    '
    '-(Bug fix) There *was* a bug that was showing blank icons for small icons in icon
    '           view mode (sm/med/lg), so a thumbnail was used for those and .exe's
    '           instead. But that bug mysteriously vanished, to be replaced by a bug
    '           that would now draw tiny icons for .exe's.
    '           I don't know what to do. This is an ongoing an bizarre issue. Windows
    '           seems to alternate bugs in the images returned by the various ways of
    '           getting thumbnails. Every time I get everything working and stop looking
    '           at every possible icon scenario, even though no code changes, Windows
    '           has conjured a new bug to start giving me the wrong icons. So I apologize
    '           in advance if whatever images Windows is returning today isn't handled by
    '           the current code. It was all working last I checked.
    '
    '-(Bug fix) The check for unsupported directories for High Perf was case sensitive,
    '           so the compiled version on Win10 incorrectly ok'd Fonts.
    '
    '-(Bug fix) Renaming items was broken.
    '           Also, cleared up some issues with renaming .lnk files beyond that.
    '
    '-(Bug fix) It seems way back in v7.3, some functions, like Delete stopped working
    '           if more than 1 item was selected. This didn't apply if done through the
    '           context menu.
    '
    '-(Bug fix) There seems to have been some sort of highly unpredictable issues around
    '           which items the shell context menu was applying to. This may be related
    '           to some circumstances that cause the IContextMenu module-level variable
    '           for the popup menu to not clear correctly, loading the previously selected
    '           items. It's now cleared at the start of the menu routine, instead of at
    '           the end, where some errors might have skipped clearing it.

  16. #136
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    Jon, a big improvement on previous versions - well done!

  17. #137
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    756

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

    Superb!

  18. #138

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

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

    Thanks fellas

    I'd like to go full virtual mode and speed things up even more, but going that way it would probably be quicker to rewrite the whole thing from scratch. In the mean time, I hope 10s flat for my 7200rpm SATA spinner to load the 60k item test is workable. By the way

    So there's a couple minor updates posted... if you already grabbed R2 a few days ago, that's the one with bug fixes. R3 is just a super cool new way of integrating with the ShellTree control, no new fixes.


    Project Updates
    UPDATE TO v9.0 R2 (Dec 5th, 2020): Several small bugs popped up that I was going to hold off on and just address in 'Known Issues' but a bug that prevented Extended Thumbnails (e.g. MP3/FLAC album art, videos) from displaying an actual thumbnail instead of the file type icon after a directory change or refresh pushed this into 'update now!' territory. Also, it seems the control either never or years since had support for Thumbnails View as the startup view? All other views worked except this. Well now it works.

    UPDATE TO v9.0 R3 (Dec 9th, 2020): Ok so I usually don't update for a minor feature, but this one makes the control look too cool to sit around for weeks or months until the next update. The integration with ucShellTree now goes even further. Instead of obviously being two separate controls side by side, I've now added an offset and some events that let you do a perfect integration just like Explorer. It's fully implemented in the DemoEx sample:



    So how's that work? Well, make sure you look through the sample in the DemoEx folder for all the details, but the basic idea is I added a property ListViewOffsetX that adds an X offset to the ListView, but not the Details Pane, Status Bar, or Control Bar. Then, I modified some properties and added events needed to support still being able to resize everything. And the demo shows all that, it can handle every resize like it used to; resizing the Shell Tree, resizing the Details Pane, resizing after showing or hiding any element, and so on. I think it looks really great now compared to the previous way you had to pair it with a tree; much more like Explorer now.

    Note: Setting the BackColor and ForeColor in the ShellTree control like in the picture on the right is a new feature in an update to that control released today as well. You'll need to grab that if you want to set the colors.

    If you're not interested in this feature there's no need to upgrade; no bug fixes this time. But I still wanted to post it

    UPDATE: I did sneak in one bug fix after 4 DLs of the original R3; if you loaded Computer/This PC (or a media device root with drives) in Tile View, the next folder after that would repeat the file name on the 3rd line. Not that big a deal especially since it went away after a refresh or the next folder after that, but did want to patch it up before too long.

    UPDATE: I had added a second little form to the sample in \Demo that has the control just set as a directory dropdown, it wasn't included in the zip. The main demo there worked fine but it gave the 'cannot load...Keep loading?' error and obviously if you clicked the 'DirOnlyForm' button that would error, so I just updated the zip with the form. This doesn't effect the control, just the demo.

    Code:
    'New in v9.0 R3 (Released 09 Dec 2020)
    '
    '-There's now a ListViewOffsetX option, which allows you to specify an x offset
    ' for the ListView within the control. It is deducted from the width. This is
    ' designed to allow the Details Pane to appear below, and the Control Bar appear
    ' above, a paired ShellTree Control; see the new screenshot and implementation
    ' in the DemoEx demo.
    ' To assist, added the event DetailPaneHeightChanged for when the size of the
    ' pane changes within the control.
    '
    '-Also added a PreviewPaneWidthChanged event for completeness.
    '
    '-Note that for both the new events described above, toggling them on/off also
    ' raises the events, with a width/height of zero when turned off.
    '
    '-For even more events, there's now ControlTypeChanged, ToggleDetailPane,
    ' TogglePreviewPane, and ToggleStatusBar.
    '
    '-The Property Gets for Detail and Preview Pane width and height will now return
    ' zero as the current value if they're not turned on, instead of the last value
    ' before they were disabled.
    '
    '-(Bug fix) If you use Computer/This PC in Tile View, the next time you load a
    '           different folder, the tiles display a repeat of the file name on the
    '           3rd line, which looks particularly bad on folders which have a blank
    '           second line. This is fixed for *almost* all circumstances, just have
    '           fix navigating directly into non-top level mobile devices.
    '           But in all cases, a refresh or navigating further resolves the issue.
    '
    '
    'New in v9.0 R2 (Released 05 Dec 2020)
    '
    '-Changed the < = > symbols in the Search Options popup to words (Less than,
    ' Equal to, Greater than' and improved a few alignments.
    '
    '-In the Details Pane, if there was more columns available than properties meant
    ' to be displayed needed, the last column wouldn't expand to fill the space, so
    ' sometimes text was truncated needlessly. It will now detect this scenario and
    ' expand the last column *actually used* to the available space.
    '
    '-(Bug fix) Extended Thumbnails Mode would only load the thumb instead of the
    '           icon if the view was changed to Thumbnails via the View menu in the
    '           current folder. Changing folders or refreshing resulted in displaying
    '           only the file type icon.
    '
    '-(Bug fix) The flag for unexpected errors in the high performance loader, the
    '           LVLoadFolderExB sub, was not cleared, so if an error occured in one
    '           folder, it would continue to be reported for all other folders and
    '           thus triggering a fallback to the regular loader.
    '
    '-(Bug fix) One scenario that would trigger the above was that while there was a
    '           check for the path being a zip, it only checked if the root of the
    '           zip would be the the current folder; e.g. C:\file.zip and didn't
    '           check if it was being asked to load an internal zip folder, e.g.
    '           C:\file.zip\zipfolder, which of course can't be loaded by HPF either.
    '
    '-(Bug fix) For keyboard shortcuts, the status of all modifier keys wasn't being
    '           taken into account: Ctrl+Shift+A would also trigger Select All, when
    '           only Ctrl+A should.
    '
    '-(Bug fix) When using Tile View mode, folders are supposed to only have 1 extra
    '           line, and this is how it appears when you switch into Tile View from
    '           another view. But if you're already in Tile View and navigate to a
    '           new folder, it adds a 2nd line that repeats the item name. This bug
    '           has been around for a while; it's fixed now with workaround-- the
    '           text was being correctly supplied as null, but to blank it out it
    '           has to be a space. Still looking for a better solution.
    '
    '-(Bug fix) Setting the initial view mode in the IDE to Thumbnail View resulted
    '           in no icons being loaded. This issue seems to date back years.
    '
    '-(Code) Several overlooked Debug.Print statements were changed to DebugAppend.

  19. #139

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

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

    Project Updated to Version 9.0 Revision 4

    I found two significant bugs: Search queries containing a semicolon for multiple strings, e.g. *.jpg;*.bmp, would fail. Also, setting PreviewPaneWidth as well as DetailsPaneHeight through code did not work. Added ability to set back/forecolor on the Search Box, pulling up the full path in the dropdown (if enabled) is now a single click instead of a double-click.

    Code:
    'New in v9.0 R4 (Released 15 Dec 2020)
    '
    '-Added SearchBoxBackColor and SearchBoxForeColor option.
    '
    '-When the Directory Dropdown can be edited, a single click now sets the text
    ' to the full path and selects all, instead of a double click.
    '
    '-(Bug fix) The PreviewPaneWidth and DetailPaneHeight Property Lets were not
    '           properly resizing the panels.
    '
    '-(Bug fix) Search queries containing a ';' (for multiple strings in a search,
    '           such as '*.bas;*.cls') would fail.

  20. #140

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

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

    Project Updated to Version 9.0 Revision 5

    Today has been a rough day for bugs... just discovered that using the New Folder item then renaming it resulted in the parent folder being renamed instead of the new folder. This seems to have popped up in v8.2, before that it worked.

    Also fixed a minor bug where the control would get stuck if you double-clicked certain printers.

    Sorry for the frequent updates.

    Code:
    'New in v9.0 R5 (Released 15 Dec 2020)
    '
    '-(Bug fix) Some objects, such as some printer objects in Devices amd Printers,
    '           have properties that trigger the 'Browse' menu option to be enabled,
    '           but obviously don't have anything to load. This broke the LVLoadFolder
    '           at a bad point; the loading marquee would be stuck on and you couldn't
    '           cancel or navigate elsewhere.
    '
    '-(Bug fix) If you used the menu option for New Folder then renamed it, it would
    '           rename the parent folder instead of the new folder.

  21. #141
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    756

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

    Don't apologise. I am in awe of the time you are spending on these improvements to VB6. Yourself, Krool, La Volpe, Olaf and others contributing to make VB6 so much more than it is out-of-the-box. Things have bugs, you fix them. I will not complain.

  22. #142

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

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

    Project Updated to Version 9.1!

    The main impetus for this release is an issue with previews; the new way introduced a few versions back of displaying previews in the Fonts folder for some unknown reason broke previewing fonts outside of the fonts folder, and caused some other preview handlers to not load at all. The new method should handle everything. Another bug prevented shortcuts to virtual locations from being followed, and a few other minor touchups were made.
    Beyond the fixes, some new features have been added too: Previously there was no quick option to just get a list the only the files selected or only the folders selected; you could either get a combined list, or need checkboxes and get those. FilesSelected, FilesSelectedFull, FoldersSelected, and FoldersSelectedFull are the additions. You can specify a manual width for tiles (the default is still automatic width), the view mode List gets rid of ridiculously sized labels, the Back/Forward options can now appear in FilesOnly mode's context menu (or if they had been in the Control Box, and that was autohidden, they'll also appear in the context menu now), you can expand the current folder in the Dropdown in all modes now-- the DropdownExpandChildren option in the main Properties window, no longer a UserOption. Finally there's now option to prevent the Details and/or Preview Panes from being resized, and if you're in FoldersOnly mode, there's an option to include shortcuts to folders.

    Lastly, there's a new Demo! I made a Demo, which also requires ucShellTree to be present (if you can load the old DemoEx, this will load, it uses the same location references), that illustrates making an advanced Open dialog out of the controls:

    The new demo has the incidental benefit of demonstrating a new feature... since it's an open dialog for images, we don't want folders going in the open selection or combo box, but do want them visible and selectable for navigation. So the demo code utilizes the new FilesSelected option for what names to put in the box, and FilesSelectedFull for the full path list for the Open button. If folders are part of the selection, they're simply not included in the list, but you can still double click them for navigation.
    Demo Note: The DemoOpenDlg demo here illustrates the need to set NoLabelWrap to False if you're going to use any of the Icon views (Med/Lg/XL icons + Thumbnails). It's False by default I forget why I turned it on, but I'm not going to update the whole DL just for that.

    Here's the full changelog:
    Code:
    'New in v9.1 (Released 08 Jan 2021)
    '
    '-There was SelectedFiles and SelectedFilesNames, and these returned both files
    ' and folders. There was FilesChecked() and FoldersChecked(), but these obviously
    ' only applied to checkmarks. Now theres FilesSelected, FilesSelectedFull,
    ' FoldersSelected, and FoldersSelectedFull (item names and their full paths,
    ' respectively). These return lists of either only the selected folders, or only
    ' the selected files.
    '
    '-You can now specify a fixed, manual tile width for Tile View with the TileWidth
    ' option. The specified value will be multiplied by the DPI scale (m_ScaleX). Set
    ' to 0 (the default) to keep using automatic width.
    '
    '-When the View Mode is set to List, all of the item labels are set to the width
    ' of the largest one in the ListView. This leads to fantastically wide labels
    ' because a single filename has dozens of characters in it. There's now the
    ' ListModeMaxWidth option, to limit this to a more rational value. The default
    ' is 200, and you can set it to 0 to disable this option and use the old behavior.
    '
    '-Added NavShowOnFilesOnlyCtxMenu, which will show Back/Forward as menu items in
    ' the View Menu when it comes up as a right-click when Files Only Mode is set.
    '
    '-The Navigation Buttons will now also show up on the background View Menu when
    ' they're normally in the control box, but the control box is invisible, like
    ' is done with the Bookmarks menu.
    '
    '-A couple versions ago, a feature was added to add the children of the folder
    ' selected in the Directory Dropdown. This was done by default only in the
    ' Directory Only and Directory Only with Controls modes, and changing it was a
    ' User Option (nExpandSelectedFolderInDropdown). This is now a standard property
    ' called DropdownExpandChildren. It retains the same options (DirOnly/DirOnlyCtl,
    ' Always, and Never) and same default (DirOnly/DirOnlyCtl).
    ' Currently, this is not support in High Performance Mode. Any folder loaded using
    ' the HPF loader won't expand.
    '
    '-Added options DetailsPaneNoResizing and PreviewPaneNoResizing. These lock the
    ' respective controls dimensions then disable the menu with the option to unload.
    '
    '-Added options FoldersOnlyIncludeLinks[HPF]. If true, includes links whose targets
    ' are folders in folders only mode. Enabled by default in normal mode, disabled by
    ' default in High Performance Mode.
    ' This option is ignored if FollowLinks is not True.
    ' Shortcuts to zip files will only be displayed if BrowseZip is True.
    '
    '-(Bug fix) Shortcuts were flagged as zip files. Not sure of the implications, but
    '           it probably caused a problem somewhere...
    '
    '-(Bug fix) Shortcuts to virtual locations were resolved to their display names
    '           instead of parsing name or nothing, so never fell back to the pidl
    '           when double clicking on one to follow. It will now try to get the
    '           pidl first, and only fall back to strings if that fails. Virtual
    '           locations work now.
    '
    '-(Bug fix) In LVLoadFolder, var li was declared in an If block then reused; the
    '           right (or, here, wrong) set of config options would result in hitting
    '           an 'undefined variable' error.
    '
    '-(Bug fix) In the View Menu for right-clicking the background in the file list,
    '           the Bookmarks submenu should appear if enabled but not visible, but the
    '           check for visibility looked at whether the control box was enabled, and
    '           not when it was actually shown, so depending on the circumstances, the
    '           Bookmarks menu would be missing when it should have been included.
    '
    '-(Bug fix) Back in V8.2 I added the ability to preview fonts in the font folder.
    '           Now, I noticed this somehow broke the ability to preview fonts outside
    '           of the fonts folder, as well as some other types of preview handlers. I
    '           can't determine exactly why some previewers break and others don't, but
    '           the method used now seems to cover all scenarios.

  23. #143

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

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

    Project Update: Version 9.2 (February 9th, 2021)
    Severe bug: I'm very sorry for a bug in the previous version that showed an incorrect menu when right clicking a file (the shell background menu where most items don't work, I was playing around with it and I guess forgot to disable it). A lot of features for the next version were ready to go, so I went ahead and released a new version instead of just a quick fix.

    This new version has a bunch of new features: There's an option to display Alternate Data Streams for NTFS volumes. The most common is the Zone.Identifier file, which is what Windows reads to warn you about files downloaded from the internet. Drag and drop works much better. You can now drop on all drop targets, such as dropping on an exe to open the dropped file with that app. The Details Pane and Search Box now use the same font as the rest of the control (new option, you can set it False to keep using a separate font). Added SelectedFilesCount, FilesSelectedCount, and FoldersSelectedCount methods to easily retrieve counts of those items.

    There's also several other less severe bug fixes.

    Code:
    'New in v9.2 (Released 09 Feb 2021)
    '
    '-NOTE: You may be noticing a pause after double clicking a folder with thousands
    '       of items before the 'Listing items' status message starts appearing; this
    '       isn't from loading the folder, it's from generating the info tip, which is
    '       triggered by mousing over the folder. You can set the info tip mode to
    '       LabelTipOnly or Disabled to eliminate this delay.
    '
    '-NOTE: As a reminder, the high performance loader has a significant difference
    '       between IDE load times and the compiled exe. Refer to the following test:
    '        Items      IDE          Compiled    (times = mean of 3 trials, dev<100ms)
    '         7.5k      1510ms         610ms
    '         20k       4540ms        2387ms
    '         57k      15790ms        9780ms
    '       The User Option bShowLoadTimeAsStatus has been added to display the load
    '       times and whether the standard loader or high performance loader was used,
    '       in the Status Bar after directory loads.
    '
    '
    '-Added the ability to display NTFS Alternative Data Streams with the ShowAltStreams
    ' option. These are hidden streams attached to files; the system uses these to
    ' create Security Zone Identifiers that display a warning about opening internet
    ' downloads. But other apps can create additional streams containing any data of
    ' any size. These files can't be handled by Explorer, so it's display only, the
    ' context menu can't take actions on them.
    '
    '-Improved drag and drop functionality. You can now drop on any files that support
    ' a drop, such as dropping on a .exe to open with, or on a shortcut to move to the
    ' target folder. The program now makes a better guess at what the default action
    ' will be for a left button drop: There's no surefire way to know what Explorer
    ' will do, since the methods it uses are not public, so previous versions might
    ' say Move To ... only to copy it when you drop, or say Copy To and then move it.
    ' It should now be correct the vast majority of the time; if it's going to a
    ' different root (i.e. a different drive, or drive to network, or network share
    ' to different network share on the same server), or being dropped on a zip file,
    ' it's flagged as a Copy. Only if it's going to a regular folder on the same drive
    ' is it flagged as a Move.
    ' Also checked more deeply than just a folder attribute. This eliminates showing
    ' the Control Panel and some others as a drop target, but a few that remain and
    ' for some reason return valid drop target interfaces, but aren't actually drop
    ' targets, like This PC, are still an issue.
    '
    '-New option: DetailsPaneUseControlFont. Up until now, the Details Pane has used
    ' the system default caption font instead of the same font as the rest of the
    ' control, whatever that may be set to. It will now by default use the same font
    ' as the rest of the control, and you can set this option to False to go back to
    ' using the caption font.
    '
    '-High performance mode now displays the shortcut overlay. This incurred no
    ' performance penalty, but supporting the Share icon (or custom overlays) would,
    ' so that will remain unsupported in this mode.
    '
    '-Searching within a set of search results is not currently supported, but the
    ' search box stayed enabled and if let you execute a search that would always
    ' return no results. To end the confusion and make it clear, the Search Box, and
    ' the menu option to bring up the Search Popup, are now disabled when a Search
    ' Results folder is being displayed.
    '
    '-The Search Box in the Control Box now uses the main font that the buttons and
    ' ListView use.
    '
    '-Added SelectedFilesCount, FilesSelectedCount, and FoldersSelectedCount methods
    ' to easily retrieve counts of those items. It saves having to calculate from the
    ' actual lists, since there's a floor of 1 entry, and if that's the only item,
    ' then you need to further check whether it's empty or not. These provide that
    ' checking for you.
    ' Reminder: SelectedFiles[Paths,Items] includes both files and folders; I didn't
    '           want to break existing code by renaming that when I introduced items
    '           to provide separate lists for files and folders.
    '
    '-(Bug fix) The new high performance mode doesn't load even the default columns
    '           unless used, so if a folder wasn't displaying the 'Type' column, the
    '           type wasn't set, which meant it wasn't displayed in the Details Pane
    '           for that item.
    '
    '-(Bug fix) The ListModeMaxWidth option introduced last version was not being
    '           applied in the High Performance loader.
    '
    '-(Bug fix) In the Column Select ListView, when Advanced Mode was enabled, the
    '           'Send to top' command set the system name column to empty.
    '
    '-(Bug fix) When creating a new control in the IDE, if you set the mode to Dir
    '           Only/Drives Only[+Ctls], you couldn't make the control height smaller
    '           than the Dir+Files limit until you closed and re-opened the form.
    '
    '-(Bug fix) A debug test option was accidentally left enabled that would show the
    '           shell background menu when right clicking a file instead of the file
    '           context menu.
    '
    '-(Demo) Bug fix: In the DemoOpenDlg demo, the Open button would display the last
    '                 set of selected files after the selection was cleared. It's
    '                 important to note this was *not* a bug with the control, just
    '                 with the demo not updating the var on frmOpen unless at least
    '                 one item was selected.
    '
    '-(Code) The drag and drop labels that pop up over the cursor were still hard
    '        coded in English. They're now constants in the main strings section if
    '        you needed to localize them.
    Note: Dropping files in a media device (e.g. cell phone, camera) may cause a freeze if running from the IDE, but it works normally without issue in the compiled exe. I'll be looking into this but didn't want to hold up the release on account of it since the it's not an issue for a compiled program.

    Note: I've modified the ucShellTree_ItemSelect event, so in the DemoEx and DemoOpenDlg projects, and potentially your own projects, if you still have an older version of ucShellTree, a message will pop up telling you it doesn't match. Just cut out all the code between Private Sub ucShellTree_ItemSelect(...) and End Sub, then delete those two lines, and select it from the dropdown again. Then paste your code back; you don't need to modify it, parameters were added but none were removed.

  24. #144

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

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

    **New update again on Feb. 11**

    Project Updated to v9.2 R3
    Quick fix: When Group View was enabled and the current View Mode was something besides Medium/Large/XL Icons, or Thumbnails, if you then switched into one of those modes, no items would appear in the list, until you refreshed the current location or opened a new one. This bug seems to have been present since the new Med/XL Icon options were added back in v7.4 so I'm not making a new post for it since it doesn't seem to be effecting anyone, but did want to get the update out immediately.

    A couple new features and a second minor fix added as well, see log.


    Project Updates in Version 9.2 R2
    Quick fix 1: Switching to Thumbnails View in High Performance mode stopped the enumeration if it came across a file with an overlay (shortcut/share). This only happened when switching; if you refreshed or loaded a new location it worked fine.

    Quick fix 2: In Directory Only and DirOnly+Controls modes, if DropdownExpandChildren was enabled, the edit box of the combo was stuck and wouldn't change. This may have affected all 9.x versions.

    Update: Also the control in development mode now always appears in the correct font. Previously it would only show a non-default font when you first changed the font property. (Runtime would apply the font you selected, just not the Form Editor/Design Mode)


    Code:
    'New in v9.2 R3 (Released 11 Feb 2021)
    '
    '-Set the default for Multiselect to be True.
    '
    '-After a search, there's an option to repeat in 'Custom...'. This can select
    ' multiple folders, and was just displayed as 'Search Results in Custom'. Now,
    ' it takes the title of the folder(s) you chose, listing up to (a default) of
    ' 3, e.g. 'Search Results in Folder1, Folder2, Folder3, ...', or if you just
    ' selected a single folder, 'Search Results in Folder1'. You can change the
    ' default of up to 3 names with the nMaxFoldersInCustomSearchLabel User Option.
    '
    '-The 'Search Again In...' footer bar (if enabled) now also appears when you
    ' navigate back to a previous set of search results.
    '
    '-(Bug fix) When Group Mode is turned on from a view besides Sm/Md/Lg Icon or
    '           Thumbnails, the first time switching to one of those view modes
    '           results in no items being displayed until the view is refreshed
    '           or a new location is loaded.
    '
    '-(Bug fix) Clicking the StatusBar while in a folder with hyperlinks as a column
    '           could trigger a link click.
    '
    '-(Bug fix) Doing a 2nd search in a folder with the same name as a previous
    '           search only created a 2nd label, e.g. Folder <2>, and if you then
    '           conducted a 3rd search also in 'Folder' (even if in a different
    '           parent), it then replaced Folder <2> instead of being Folder <3>.
    '
    'New in v9.2 R2 (Released 10 Feb 2021)
    '
    '-When selecting a new font, it would show in development mode when selected, but
    ' after that whenever the form was reloaded in development mode the control would
    ' appear with the default font (even though the one you selected was applied at
    ' runtime). The control in development mode now always reflects the correct font.
    '
    '-(Bug fix) Switching to Thumbnails View in High Performance mode would stop the
    '           enumeration when it hit a file with an overlay.
    '
    '-(Bug fix) If DropdownExpandChildren was enabled and the control was in Dir Only
    '           or Dir Only + Ctl mode, the current selection wouldn't change.

  25. #145
    Junior Member
    Join Date
    Mar 2019
    Posts
    17

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

    Hello fafalone,

    thank you very much for ucShellBrowse.

    I am only starting to use it very recently, please forgive the stupid noob question. When I call ucShellBrowse1.BrowserPath with a non-existend path, it seems that I get into the SimpleDialog() function, which itself calls TaskDialog (declared into comctl32.dll). I am on W10 32 Bit and it seems that my comctl32.dll does not have such an entry point. I checked for comctl32.dll from various other windows versions (XP, Vista, Win8...) but couldn't find any comctl32.dll with such an entry point.

    Could you have a look?

    Tx,

    THN

  26. #146
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    Entry point errors such as this are almost always caused by not having a Common Controls 6.0.0 manifest for the IDE and, when compiled, for the exe.

    Here is a very simple manifest that you can put beside your VB6.exe file in C:\Program Files (x86)\Microsoft Visual Studio\VB98. Copy this into notepad and then save into the path mentioned as VB6.exe.Manifest

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity type="win32" processorArchitecture="*" version="6.0.0.0" name="mash"/>
    <description>Enter your Description Here</description>
    <dependency>
       <dependentAssembly>
          <assemblyIdentity
               type="win32"
               name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
               language="*"
               processorArchitecture="*"
             publicKeyToken="6595b64144ccf1df"
          />
       </dependentAssembly>
    </dependency>
    </assembly>

  27. #147
    Junior Member
    Join Date
    Mar 2019
    Posts
    17

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

    I apologize but your suggested solution does not work.
    I have put the recommended manifest in
    C:\Program Files\Microsoft Visual Studio\VB98
    and also in
    C:\Windows\System32
    but still get the same error from within the IDE.

    The compiled exe just ends w/o giving any output or error.

    This is info about the comctl in my W10:
    Code:
    File Type: WINDOWS EXECUTABLE
    
    File Version Information:
      File Version:                  5.82.19041.488
      Product Version:               10.0.19041.488
      File Type:                     0x00000002 (Dynamic-link library)
      File Subtype:                  0x00000000
      File Flags Mask:               0x0000003F
      File Flags:                    0x00000000
      String File Information:       1033 (Englisch (Vereinigte Staaten))
        CompanyName:                 Microsoft Corporation
        FileDescription:             Common Controls Library
        FileVersion:                 5.82 (WinBuild.160101.0800)
        InternalName:                COMCTL32
        LegalCopyright:              © Microsoft Corporation. All rights reserved.
        OriginalFilename:            COMCTL32.DLL
        ProductName:                 Microsoft® Windows® Operating System
        ProductVersion:              10.0.19041.488
    
    File Header:
      Machine:                       0x014C (Intel x86)
      Number of Sections:            5
      Time Date Stamp:               0x093B7A4C (28.11.1974 18:47:56)
      Pointer to Symbol Table:       0x00000000
      Number of Symbols:             0
      Size of Optional Header:       0x00E0 (224)
      Characteristics:               0x2102
        File is executable
        32 bit word machine
        File is a DLL
    Attached Images Attached Images  
    Last edited by THN1234; Mar 4th, 2021 at 09:03 AM.

  28. #148
    Fanatic Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    538

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

    Hi just seen your message but I am very short of time. Do the following, if this doesn't work you will have to zip up your entire code and post it for fafalone to look at.

    In declaration section of module or form.
    Code:
    Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
    PRivate Declare Function IsUserAnAdmin Lib "shell32" () As Boolean
    In Sub Main or form initialise if you do not have a module.
    Code:
    IsUserAnAdmin
    InitCommonControls

  29. #149

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

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

    There's some Windows setting on some versions that prevents the recognition of an external manifest.

    But that's really an oversight, the control is designed to provide basic function without the manifest... all of the uses of it are the same, so for an immediate fix in the SimpleDialog function, substitute a regular msgbox instead:
    Code:
    If IsComCtl6 Then
        Call TaskDialog(hWndOwner, hinst, pszTitle, pszMain, pszContent, dwBtn, dwIcon, pnButton)
    Else
        SimpleDialog = MsgBox(iif(sMainText <> "", sMainText & vbCrLf & vbCrLf & sMessage, sMessage), vbOKOnly, sTitle)
        Exit Function
    End If
    Of course it's highly advised, and the control (and your app) will look much better and have all functions available, if you go ahead and add a manifest, but it's not strictly required.

    You can also add a .RES file via Project->Add File, like the resDemo.res included for the demos, with a manifest.

    (This is also fixed in the new version below)

  30. #150

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

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

    Project Update - Version 9.3 Released

    This new update contains a large number of both new features and bug fixes, be sure to read the changelog to get everything. The most interesting new features: Custom Icon mode. You can now supply custom icons easily for each file; see the changelog below for detailed instructions. It's also now possible to set the ListView and ComboBox fonts independently from the rest of the control. You can also now use the CompareStringEx API to specify your own sorting locale and options, instead of always using the system default.

    Code:
    '-----------------------------Using Custom Icon Mode------------------------------
    'Version 9.3 introduced an option to supply custom icons for each file.
    'This is the SB_VIEW_CUSTOM member of the View Modes.
    '
    'The CustomIconsEnabled option sets whether this mode appears in the View Menu.
    'You can of course set the mode to SB_VIEW_CUSTOM in your control Properties or
    'though code and not have this or any option to switch view modes. If it is in
    'the menu, it uses the caption from CustomIconsCaption.
    '
    'Set the size the custom icons will be in the CustomIconsSize property. This value
    'will be multiplied by the DPI zoom factor, the final value will be reported when
    'the control asks for the icons.
    '
    'Next, when the control needs an image (which could be during the folder load, or
    'later when it's scrolled into view, depending on mode), it raises the event
    'QueryCustomIcon. This event supplies a number of details about the file (this
    'includes a reference to the pidl, it's not a copy so don't free it), and a value
    'indicating the size the control is using, which is the value from CustomIconsSize
    'multiplied by the DPI zoom. The next two params are what you set to a handle for
    'your image. You only need to specify either an HBITMAP or an HICON, not both, if
    'both are set it uses the HICON. The last argument indicates whether to free the
    'image with DestroyIcon/DeleteObject after it's added.
    '
    'Finally, if a file with an overlay, such as a link, is encountered, the event
    'QueryCustomIconOverlay is raised. Do not set a return value to use the system
    'overlay for that index, set it to 0 to not use one, or supply your own, again as
    'either an HBITMAP or HICON with the size specified by the cxy argument.
    '
    'NOTE: This may be unstable in the IDE, but works fine when compiled.
    '---------------------------------------------------------------------------------
    '
    '------------------------------------CHANGELOG------------------------------------
    '
    'New in v9.3 (Released 04 Mar 2021)
    '
    '-If there's a blank BrowserPath value and a Custom Root set, the control will
    ' now open to (if not blank or previous location) the root, rather than App.Path.
    '
    '-BrowserPath now also supports using Environment Variables like %windir% or
    ' %ProgramFiles% as startup paths.
    '
    '-Previously, Environmental Variables were only supported if the path was only a
    ' single var, such as %WINDIR%. %WINDIR%\Fonts wasn't supported. The control now
    ' uses the ExpandEnvironmentStringsW API to expand all the variables within a
    ' path, so now you would have that load C:\Windows\Fonts, or even use a 2nd var,
    ' like %ProgramFiles%\MyApp\%USERNAME% loads C:\Program Files (x86)\MyApp\Name.
    '
    '-Added an easier route to set the font of the ListView independently. Normally,
    ' the main UserControl Font property is applied to everything. Now, there's two
    ' new Public Sub methods:
    '     ListViewSetFontOLE - Supply a StdFont object (the VB standard .Font for
    '                          controls). nApplyScaling sets whether to apply a DPI
    '                          based scale like is applied when setting the main UC
    '                          Font property; 0=Do not apply, 1=Apply if the option
    '                          FontScaleForDPI is True, 2=Always apply. Also includes
    '                          an option to specify a different font for the header.
    '
    '   ListViewSetFontByHandle - If you have an HFONT handle for a font, this lets
    '                             you apply it directly. You can optionally specify a
    '                             different font for the column header.
    '
    '-Added the same as above for the Directory Dropdown, ComboSetFontByHandle and
    ' ComboSetFontOLE, with the latter having the same nApplyScaling argument.
    '
    '-The Column Select ListView now inherits the same font as the main ListView by
    ' default (and if you've set them independently with the new option above it will
    ' inherit those instead); set via new User Option bColLVInheritFont
    '
    '-For sorting strings in the file list (e.g. File name), the control has used the
    ' StrCmpLogicalW API, which is the same API that Explorer uses. This applies the
    ' current system locale and the default options. There's now a public method named
    ' SetAdvancedStringSort that allows you to use the CompareStringEx API instead,
    ' allowing you to specify your own locale and options set. Note: No options are
    ' specified by default, so leaving that parameter blank is not recommended. The
    ' locale name can be left at its default, which applies LOCALE_NAME_INVARIANT.
    '
    '-The control has had an option to set a custom ImageList, but that wasn't really
    ' useful without a way to link it to individual files. There's now a new view mode
    ' called SB_VIEW_CUSTOM. See the 'Using Custom Icon Mode' section.
    '
    '-The DetailsPaneNoResizing option would leave the DetailsPaneHeightLocked option
    ' set to True when it was set to False (allow resize), which gave the impression
    ' that resizing was still not allowed unless the user figured out to right click
    ' then unlock the height. To make things clearer, setting this option to False,
    ' i.e. resizing allowed, will now also unlock the height until and unless that
    ' option is set back to False.
    '
    '-Made the UserControl ScaleWidth and ScaleHeight available as Property Gets, but
    ' these are read only, setting them caused problems.
    '
    '-Windows was doing something really funky after updating the properties in some
    ' instances: It copied the file to a new .tmp file, created another new temp file,
    ' deleted the original, renamed 1 tmp file, and deleted the other.
    ' This caused a problem if you were using a filter to only show certain files.
    ' The original was removed from the list upon deletion, then the new .tmp file
    ' didn't match the filter so wasn't added, making the file simply disappear until
    ' the folder was refreshed.
    ' To address this, the rename handler responding to SHCNE_RENAMEITEM checks both
    ' names against the filter, and if the old name didn't match the filter, but the
    ' new name does, it now processes the newly renamed file as a file creation, sent
    ' though LVAddEntry.
    ' Additionally, if an item is renamed and no longer matches the filter, it will
    ' now be removed.
    ' These options are controlled by the new UserOptions bRemoveNewFilteredItem and
    ' bInsertNewFilterMatches, which are True (enabled) by default.
    '
    '-The control now supports switching between all types during runtime; previously
    ' only switching between FilesOnly and DirAndFiles worked well, with the other
    ' combinations being unsupported and having various bugs.
    '
    '-BrowserPathItem now has a Let method too, that redirects to BrowserOpenItem.
    '
    '-(Bug fix) The BrowserPath would keep getting reset to App.Path if blank.
    '
    '-(Bug fix) In the Details Pane, if you started to edit a property, then hit the
    '           cancel button, if you again started to edit the same property, it
    '           would not trigger the Save/Cancel buttons to appear, you'd have to
    '           edit a different property.
    '
    '-(Bug fix) In the Details Pane, if you edited a formatted number, then hit the
    '           cancel button before saving, when you went to edit that property
    '           again, it would show the full formatted string rather than just the
    '           number that you need to edit, which would obviously then cause an
    '           error if you attempted to save the non-numerical value.
    '
    '-(Bug fix) In the Details Pane, most of the time when you started editing a text
    '           field, the arrow keys would move keyboard focus off to elsewhere.
    '           Focus is now properly set so the arrow keys let you move around in
    '           the box.
    '
    '-(Bug fix) The Search Box also now supports using the arrow keys most of the
    '           time. A few circumstances you might need to click away then back to
    '           get them working.
    '
    '-(Bug fix) The height of the StatusBar was factored into the Detail Pane min
    '           height whether it was visible or not, resulting in a larger height
    '           when the StatusBar was disabled.
    '
    '-(Bug fix) Some error messages were being displayed with a TaskDialog without
    '           checking if ComCtl6 was available, leading to a 'Can't find entry
    '           point' error.
    '
    '-(Bug fix) Menu tips for View Menu items had stopped working when accessed from
    '           the View button.
    '
    '-(Bug fix) If the Control Type was DirOnly+Controls, changing the Navigation
    '           Button type would reposition things completely wrong.
    '
    '-(Bug fix) In Drives Only mode, the initial path was incorrectly reported as
    '           the configured startup path (App.Path by default). Also, not all
    '           path related variables were set correctly since it was calling
    '           LVLoadFolder with no ListView present; there's now a special handler
    '           for this mode that skips that unneccessary routine.
    '
    '-(Bug fix) With a larger font size, the Directory Dropdown became larger in
    '           height, and could overshoot the ListView and wind up partially on
    '           top of it. Meanwhile, the Search Box stayed the height it was for a
    '           default font size of 10, meaning letters would get cut off. The
    '           ListView top and Search Box height now accomodate larger fonts.
    '           ListControlBox buttons have their font point size limited to 10
    '           because of physical size limits can change with new User Option
    '           nLimitPointSizeForButtons. Additionally, ListControlBox buttons have
    '           their height adjusted to match the combobox.
    '
    '-(Bug fix) When Group View is enabled, and the View Mode is set to Small Icon,
    '           any groups with file names that run into the next column result in
    '           items disappearing and sometimes, or sometimes not, reappearing with
    '           mouse overs. This effects other API-based ListViews with Group View
    '           and SmallIcon view as well. There's a User Option enabled by default,
    '           bEnableFixForGVSMICON, that will fix the width of the columns that
    '           are formed, then manually limit label lengths to prevent this bug.
    '           Renaming still works normally (it will display the full name when
    '           you begin the label edit), and names are restored when switching
    '           to another view. I'm on the lookout for a better fix.
    '           This fix is not currently implemented for High Performance Mode.

  31. #151
    Junior Member
    Join Date
    Mar 2019
    Posts
    17

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

    Hello fafalone

    thanks for your help.

    Firstly, the two declares suggested by Steve do not solve the problem, behaviour (only when supplied path is non-existent) is still the same.

    For your suggestion, indeed IsComCtl6 is False in my case (because tDVI.dwMajor is only 5) and hence triggers the standard MsgBox, which of course works OK.

    So problem lies in my comctl32 beeing too low / too old? Strange this is since I'm on the latest W10 Pro 20H2 32 bit and a little puzzled. Anyway, I included the demo.res from your v9.3 in my project and now it also works OK in all cases.

    Thank you again.

    Best,

    THN
    Last edited by THN1234; Mar 5th, 2021 at 03:30 AM.

  32. #152

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

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

    I'd assume Windows is not recognizing external manifests. Glad the resource file is working, you can always use something like LaVolpe's Manifest Creator to make new resource files or insert a manifest into an existing resource if you had one in another project.

    If you wanted it enabled in the IDE too, to modify the vb6 exe you'd use something like ResourceHacker; open vb6.exe -> Action -> Add from script template -> Manifest -> Add Resource -> Paste your manifest instead or at least remove the compatibility section and DPI aware section (vb6 looks funky with that) -> Action -> Compile -> File -> Save
    Here's the one I use in my VB6 exe:
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity
       version="1.0.0.0"
       processorArchitecture="X86"
       name="Microsoft.VB6.VBnetStyles"
       type="win32"
    />
    <description>VBnet Manifest for VB6 IDE</description>
    <dependency>
       <dependentAssembly>
         <assemblyIdentity
           type="win32"
           name="Microsoft.Windows.Common-Controls"
           version="6.0.0.0"
           processorArchitecture="X86"
           publicKeyToken="6595b64144ccf1df"
           language="*"
         />
       </dependentAssembly>
    </dependency>
    </assembly>
    Common Controls 6.0 was introduced with Windows Vista so you have the current version... it just needs to be enabled using a manifest, otherwise for legacy compatibility with older apps it only loads 5.0.

  33. #153

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

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

    Project Updated to Version 9.3 Revision 2: Critical Bug Fix
    Going back to the startup folder (if not blank or last path) produced an error that the path could not be loaded and graphical/functional failures in the currently displayed path. This was due to the code change to unstick App.Path in the Properties Window BrowserPath item, for starting in a given path (app path if blank).

    Also provided fixes for the Search Box being drawn too tall if a very small font was being used in the control, and System Names disappearing from Advanced Mode in the Column Select popup.
    Updated the Search Popup to put the search terms box, if being displayed, at the bottom with enough space instead of crammed into the top right and overlapping other controls if a large font was being used, and applied that font since it hadn't been.

    Code:
    'New in v9.3 Revision 2 (Released 11 Mar 2021)
    '
    '-Adjusted the Search Popup; now if there's a box to enter your query, it's placed
    ' on the bottom after having made extra space, instead of cramming it in at the
    ' top, which would overlap the controls if the font size was bigger than default;
    ' the size of the font is now taken into account as well.
    ' (Bug) It was sized for main font but didn't use the main font until now.
    '
    '-When using Group View to group by Type, the header now includes the default icon
    ' for that type. This can be toggled on/off (on by default) with new UserOption
    ' bGroupViewUseIconsForType.
    '
    '-(Bug fix) When the Column Select ListView was in Advanced Mode, moving an item
    '           up, down, or to the top, via the UpDown buttons or the menu option
    '           caused the System Name to be cleared.
    '
    '-(Bug fix) Using a font much smaller than defaults would result in the Search Box
    '           being sized *too big* and over shooting the draw area.
    '
    '-(Bug fix) If startup went to a regular path, you couldn't go all the way to the
    '           startup path going Back in History. Trying to do so produced an error
    '           and broke display of the current location.
    Sorry guys hadn't considered how the history subsystem might have been effected.

  34. #154

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

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

    Project Update: Version 9.4
    (Note: 9.3 R3 was just released a couple days ago and contained critical updates, so if you missed it make sure to grab 9.4 even if you don't care about this change to make sure you cover the bugs. Sorry, I've been working on this problem on and off since Version 1.0, finally solved it, and wanted to share immediately instead of whenever there's a big batch of changes)

    It's finally nice to have an immediate update because something **GOOD** has occured: I have finally solved implementing IOleInPlaceActiveObject based keyboard focus control for UserControls with multiple subcontrols on them. Previously this technique was limited to single-control UserControls. What this means: Arrow keys work EVERYWHERE in the RIGHT WAY. As soon as you click a control, it doesn't matter what the last control was, the arrow keys will now work as they're supposed to, instead of being sent to the wrong control! (This was a problem far harder than you'd ever imagine).
    That's the only change. Wanted it out immediately

    Code:
    'New in v9.4 (Released 13 Mar 2021)
    '
    '-I was finally able to figure out how to implement IOleInPlaceActiveObject-based
    ' keyboard focus control. The arrow keys work the first time in almost all
    ' circumstances now; the FilterBars on ListViews don't seem to support them? But
    ' besides that, they're working everywhere; ListView, Combo edit, search box, file
    ' properties in the Details Bar, all controls on the Column Select and Search Ops/
    ' Advanced Search popups.

  35. #155
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Posts
    2,892

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

    Quote Originally Posted by fafalone View Post
    I have finally solved implementing IOleInPlaceActiveObject based keyboard focus control for UserControls with multiple subcontrols on them. Previously this technique was limited to single-control UserControls.
    Just curious what changes you made (would have peeked commit history if this project was on github) because current IPAO implementation looks faily standard IMO.

    Was there some kind of a bug in the previous impl or is there a new revelation about Ax UI interactions you would like to share?

    cheers,
    </wqw>

  36. #156

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

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

    The issue was getting it to work when the UserControl has a whole bunch of subcontrols on it, mixed between VB controls and API controls. I've had it forever in the ShellTree control that goes along with this for example, because that's just the one control. But when it came to this UC, I was never able to find just the right way to arrange calls and focus changes to get it to work consistently. It's not a change to the baseline code, just how calls to it are structured to produce reliable results with this kind of control arrangement... in the past there would always be some combination of last click + current click that resulted in arrow keys/tab going to the wrong place.

    If anyone thinks this is all trivial, they should have enlightened me earlier

    And now that I got that working... TABS:

    Project Update: Version 9.4 R2
    This continues the IOleInPlaceActiveObject keyboard functionality: After an epic 8-hour non-stop coding marathon, I've figured out how to fully implement tab functionality. There's a Tab Loop that goes through all elements; the ListView, ComboBox, Control Bar, Search Box, and then back to the host form. Then the Details Pane properties will loop through eachother, to the save buttons if present, then to the ListView. The Column Select and Search Popup each have their own tab loop for their elements.

    Code:
    'New in v9.4 R2 (Released 13 Mar 2021)
    '
    '-Also was able to create a full Tab sequence: The start is the ListView. Then to
    ' the combo, up button, back button and fwd button (std btns only), view button,
    ' bookmark button, search box, then off the control.
    ' In the Details Pane, you can tab through each property, then to the save and the
    ' cancel buttons if present, then to the ListView to start that sequence.
    ' For the Column Select and Search Popup, their tab loops are mostly working, but
    ' they may still be a little buggy.

  37. #157

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

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

    Project Update: Version 9.4 R3

    Ok let's try this one more time. The new IPAO setup had one major and one minor bug:

    An item already selected couldn't be double-clicked due to an IPAO workaround. Found a solution without using that workaround at all, so now there's no special tricks it just handles click/double click/rename normally. Details Pane tabbing put you into an edit box you could wrongly type in instead of creating an alt control, and alt controls didn't have arrow key / tab focus... now they do. Also if you very first click was on the ListView on load, the arrow keys/tab didn't work until the 2nd click; this has been fixed.
    Also, added Shift+Tab functionality to go backwards in the order, and put white backgrounds back in active detail edit boxes.

    Code:
    'New in v9.4 R3 (Released 13 Mar 2021)
    '
    '-Full shift+tab to go backwards in the tab order is now working for all items.
    '
    '-(Bug fix) A workaround for having rename by label edit work with the new IPAO
    '           stuff resulted in not being able to double-click an item that was
    '           already selected (you had to double-click it while another item was
    '           selected). Turns out the workaround wasn't even needed by ensuring
    '           the IPAO init fires for the UC before the LV on load.
    '
    '-(Bug fix) Tabbing through Details with alt controls (datetime or combo) would
    '           put you in an typeable edit box, which is obviously wrong. The alt
    '           controls and everything in now handled by the focus message, so not
    '           only will the alt control pop up, it will have arrow key/tab focus,
    '           and can then tab to the next one.
    '
    '-(Bug fix) On load, the very first click to the ListView didn't set IPAO focus
    '           for arrows.
    '
    '-(Bug fix) The Detail item edit boxes weren't having their white backgrounds
    '           set during editing.

  38. #158

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

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

    Project Update: Version 9.4 R4

    I was setting up a thumbnail viewer based on this control and noticed a number of issues. If the monitor zoom was more than 100%, only a corner of image files would be included in the thumbnail. Between that and a few other adjustments, thumbnail view is much better now and displays the same thing across multiple scales. Included a new demo based of a thumbnail viewer: DemoThumbView- it's a completely locked down configuration that simply displays the thumbnails of a given directory. All panels are disabled, navigation and any option that would lead to it is disabled, the view mode is locked, etc, it's just a panel of thumbs.

    Also added some minor things; option for whether groups are enabled, whether pasting is enabled, and removed sort from the menu if it's disabled.

    Code:
    'New in v9.4 R4 (Released 15 Mar 2021)
    '
    '-Made major improvements to thumbnail view. The previous method would, for image
    ' files, just show a chunk rather than a scaled down version. And sometimes lose
    ' transparency in .ICO files. All that varying depending on monitor zoom. I've
    ' redone things to take the best approach for each type, so it shows all extended
    ' thumbnails and image thumbnails, scaled properly, etc.
    '
    '-Added a new demo: A pure thumbnail viewer. All parts besides the view are hidden
    ' and disabled, all navigation is disabled, etc. DemoThumbView.
    '
    '-Added option for enabling the Group By.. submenu. It was previously controlled
    ' with LockNavigation.
    '
    '-Added option to disabling pasting (and remove it from the menu).
    '
    '-(Bug fix) The Back/Fwd buttons would appear in the background menu (in the
    '           situations they normally would) event if LockNavigation was enabled.
    '
    '-(Bug fix) Sorting appeared in the View Menu even if it was disabled.
    Name:  ucsb-dtv.jpg
Views: 61
Size:  112.4 KB

  39. #159

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

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

    Project Update: Version 9.4 R5

    Just needed to clean up a few outstanding bugs. Thumbnail view labels overlapped if you used a larger font size, overlays (shortcut arrow, etc) would show up as black boxes in Icon/Thumbnail/Custom views once you navigated to a new directory (the first directory you switched to that view would be fine), fixed icons getting truncated in the Preview frame, Files Only mode had the dropdown space shown (it was blank, but added a big gap), and removed ghost click events where they fired from background clicks with no file selected. Also found a significant source of memory leakage; menu icons weren't freed.

    Code:
    'New in v9.4 R5 (March 16, 2021)
    '
    '-(Bug fix) Fixed a number of memory leaks.
    '
    '-(Bug fix) File click events would be raised with empty paths if none selected.
    '
    '-(Bug fix) If the ListView font size was larger, thumbnail view labels would
    '           overlap the one under it since the manual spacing that mode uses did
    '           not account for different sizes.
    '
    '-(Bug fix) In High Performance Mode, overlays (shortcuts, etc) would show as
    '           black boxes when you navigated to a new directory in Med/L/XL Icon
    '           View, Thumbnail View, and Custom View (if you switched to those views
    '           the current directory would be fine).
    '
    '-(Bug fix) Fixed icon sizing for the preview frame. I'm aware that on Win10 it
    '           may only be loading very small sizes; this effects thumbnail view
    '           as well, but this will have to be investigated in the future.
    '
    '-(Bug fix) If your initial control type is Files Only, there was a gap at the top
    '           where the dropdown would be if it was enabled.

  40. #160
    Addicted Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    220

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

    very good work everything works perfect,
    even much faster than previous versions.

    a few minor issues with ucShellTree

    procedures does match
    Code:
    Private Sub ucShellTree1_ItemSelect(siItem As oleexp.IShellItem, sName As String, sFullPath As String, bFolder As Boolean, hItem As Long)
    'If bStartup = False Then
        If bFolder Then
            'Previously we set by path, but this won't work with Win10 virtual devices like phones and cameras
            'ucShellTree had to be extensively modified to not navigate or set the selected ishellitem by just the path either
    '        ucShellBrowse1.BrowserPath = sFullPath
             ucShellBrowse1.BrowserOpenItem siItem 'ucShellTree1.SelectedShellItem
        End If
    'End If
    End Sub
    me use 2.5-R2
    Code:
    Private Sub ucShellTree1_ItemSelect(sName As String, sFullPath As String, bFolder As Boolean, hItem As Long)
    
    End Sub

    greetings very good job

Page 4 of 5 FirstFirst 12345 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
  •  



Click Here to Expand Forum to Full Width