


ucShellBrowse v1.0
About
This project started its life as an attempt to select a file right on a Property Page without having to click an additional button. There's still a lot of outstanding issues severely limiting the practicality, usability, and stability of that version, so pending further development on that I continued to make a UserControl version. This is basically having an updated, prettier version of VB's DirList/FileListBox, with further options that allow it to have the power of an actual Explorer window-- but doing it with a ComboBoxEx and ListView allow for customizations and features not possible if you were to simply host an instance of Explorer itself instead. It integrates many of the techniques my small sample projects have shown over the past few years.
Key Features
- Full Unicode support
- Icons, display names, and properties are identical to what a user sees in Explorer. Includes overlay icons for things like shares or links; supports custom ones like used by DropBox or Github.
- Full navigation tree from the desktop-- virtual objects that are part of the file system, such as Computer or Libraries, are able to be used normally, and the selections real file system path is resolved and returned.
- Support for several different view modes: Large icon, small icon, list, details, tiles, and thumbnails.
- Thumbnail View uses the code from my ThumbsEx project, which goes beyond what Explorer can do by using GDI+ to center and frame images smaller than the thumbnail size. The thumbnail size can be set to any value.
- Optional setting to enable extended thumbnails, like video files showing the first frame.
- Images and all types with a registered preview handler can be previewed in an optional preview pane.
- 'Group by' is fully implemented; can group for extended properties
- Right click brings up the standard shell context menu
- Sort is supported for all columns and uses the same API that is used by Explorer, so order is identical
- A filter can be applied to only show files matching a certain type (PathMatchSpecW); an option specifies whether it's single-select or multi-select.
- Supports rename-in-place with ListView LabelEdit, with blocks and warning popups to prevent disallowed characters. Renames are carried out through Explorer via IFileOperation.
- Rename, and other functionality, is still supported even if file name extensions are hidden (the ListView uses the Explorer displayname, so if they're hidden in Explorer they're hidden here)
- Supports 'Create new folder' where a new folder is created, with its name the next in sequence if needed, and a label edit to rename is automatically initiated.
- Supports both dragging out and receiving dropped files, complete with the file icons you see in Explorer. Drops go through Explorer, meaning 3rd party shell extensions like WinRAR are supported.
- All column headers found in Explorer are available to be added/removed/sorted by/grouped by, directly interfacing with the Windows Property System and each files Property Store.
- Default column headers are loaded for each folder from Explorer; so when you browse to your Music library you get Artist, Album, Title, and Track as the columns (this behavior can be disabled)
- Optional status bar that shows the number of files, their total size, and menu item help. A custom message can also be set.
- The Back/Up/View control box can be shown or hidden; this combined with option to limit or turn off columns allows for compacting down to the same size as the original VB file browsing controls. ListView icons can even be hidden.
- There's substantial interaction with the host form, informing your program of selection change, clicks, double clicks/enter press, directory change, renames, and file drops. These events provide both full paths and references to the file(s) IShellItem(Array) interfaces
- The startup path can be customized and is remembered. The current path can be manually changed through a .BrowserPath property.
- Custom draw is used to show encrypted files in green and compressed files in blue to be consistent with Explorer (this can also be forced on or forced off)
There's also fairly extensive debug output to the Immediate window. You can stop it from appearing by changing the 2nd line of ucShellBrowse.ctl; Private Const dbg_PrintToImmediate As Boolean = True --Change it to False to stop debug printing.
Requirements
-Windows Vista or newer
-If using this as a .ctl, your project must contain mSBSubclass.bas (from the main folder of the project), or the code from it placed in another .bas, and have a reference to oleexp.tlb v4.3 or higher (released 11 Sep 2017).
To use the control as an OCX, open ShellBrowse.vbp from the main folder, change the UserControl to 'Public', and compile. Then proceed to move, register, and use as you would any other .ocx. A project with the OCX does not require mSBSubclass.bas or oleexp.tlb. For future versions, I'll inquire with the admins about posting a pre-compiled .ocx.
The folder \Demo\ contains Project1.vbp which uses the control as an in-project .ctl.
Future Plans
There are a few advanced features, that aren't critical, that are going to take me a few weeks to finish. But I wanted to put out an initial release in the mean time and see how things go. These include:
-A details bar like the bottom of Explorer windows. This is more complex than one would think since it needs to detect if there's a registered property handler, and if so, load the PreviewDetails, figure out how many can fit in the current bar size, align them, and provide the ability to edit them. There's some debug code commented out that shows some of the techniques involved if you're interested in exploring that on your own before I finish it, in LVDoubleClick.
-Providing dynamic dragover highlighting. So when a user drag a file over from another app, if it's dragged over a folder or a zip file that's displayed in the ListView, that item is highlighted and can be dropped on. I've developed code to do this already, but it's not portable at all so will take a while to add to a new project.
-Registering with SHChangeNotifyRegister to monitor for file/folder changes and update accordingly. Much more complicated than you'd think, especially to keep the folder tree updated as well. There's a Refresh call and a RefreshTree call to manually update things in the mean time.
If there's another feature you'd like to see don't hesitate to suggest it :wave:
This project is complicated and still under development
And I'm doing it for fun in my spare time, so don't expect commercial production grade code. I know basic functionality is working right now, and every feature was working when it was added, but there's almost certainly going to be a few bugs here and there in the 10,000 lines that make up this extensive project. It's simply not possible to test every feature in every scenario it may encounter.
So if you encounter a bug, kindly let me know and I'll get it fixed for the next release.
Since it's still under active development, there's also a lot of commented out debug code left in, and definitions from common control headers that aren't used. This will be cleaned up once it's feature-complete. (It's also a principle of mine, I'm always curious and interested in seeing these kind of things in others code, so I tend to leave it in for my projects in this forum, in case anyone else shares my interest).