Results 1 to 14 of 14

Thread: [RESOLVED] Shell Browser UserControl; development/feedback/beta

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Resolved [RESOLVED] Shell Browser UserControl; development/feedback/beta

    So this projected started with basically creating an open file dialog manually on a PropertyPage. But I thought it would be useful to have as a UserControl too, and have gotten much farther along with this version, since we've got some outstanding issues with the PropertyPage that don't apply to the UserControl (keyboard use and stability primarily), so I'm making a separate thread for this.

    It's by far the largest demo project yet I've worked on, combining the new directory dropdown with the ListView, bringing in many of the small techniques I've posted in the past few years. The idea is to replace the ugly old VB DirList/FileList with a nice looking modern one.

    Basically what I'm looking for in this thread is- since for various reasons it was decided to go with a ListView manually implementing things, what Explorer or other features would be helpful in a control like this? Many of the major ones are partially or fully implemented, but there's plenty still not there too. Like, is full thumbnail view worth it? New folder or item support?
    And also for anyone who wants to check out the progress while it's developed before the final version for the CodeBank.

    It supports the original compact view or a larger view through various options (size, control box, list view mode)

    The 2nd image shows a bunch of features: Extended details, group mode + group by extended details, original shell context menu, and the control box.
    And it's got the new dropdown navigation unchanged from the PropertyPage version, which along with the ListView supports normal navigation through virtual locations like Computer or Libraries; you can even drag a file into a Library and it queries the default save location for that library and drops it there.




    Feature summary:
    Code:
    '*******************************************************************
    '
    'ucShellBrowse.ctl
    'Shell Browser v1.0
    '
    'This is a usercontrol that provides a shell browser similar to an
    'Open/Save dialog that can be placed right on a form instead. It
    'implements most of the functionality of a standard view, and does
    'so manually rather than use an actual control like the dialogs or
    'the IExplorerBrowser object, such that it can be further adjusted
    'with custom features.
    '
    '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, and tiles. Thumbnail view at the moment just shows
    ' the system's 256x256 icon (which may be a thumbnail depending on
    ' system settings); a full thumbview is planned for the future.
    '-'Group by' is fully implemented; can group for extended properties
    '-Right click brings up the standard shell context menu, both for
    ' selected items and the background folder menu (Known issue: the
    ' 'New' and 'Share' menus are empty for the background)
    '-Sort is supported for all columns and uses the same API that is
    ' used by Explorer, so order is identical
    '-Supports rename-in-place, which enters into the system Undo
    '-Supports both dragging out and receiving dropped files, complete
    ' with the file icons you see in Explorer. Drops are handled by
    ' Explorer, but older code that does it all manually is there if
    ' you prefer that (LVHandleDrop).
    '-All column headers found in Explorer are available
    '-Ability to show/hide by default the main columns (name is always
    ' shown but size,type,datemod (on by default) +datecreated,dateaccessed
    ' can be toggled
    '-The Back/Up/View control box can be shown or hidden; this combined with
    ' the columns option allows you to create a more compact look if needed
    So what else is needed? Including any UserControl properties or events that might be needed? What's wrong?

    The requirements are as small as possible; the project needs a reference to oleexp.tlb v4.3+ (the newest one, released 2017-Sep-11), and a small regular module that redirects subclassing back to the object. WinXP is not supported.

    (PS: I was also thinking, since a UserControl solves the problems we're having with the PropertyPage, could we just place the UserControl version on the PropertyPage? Would the keyboard navigation be retained?)

    Update - 28 Sep 2017

    Beta 2
    Code:
    '------------------------------CHANGELOG------------------------------
    '0.2
    '-Added New Folder support, autostarts a rename like Explorer, and will
    ' pick next name in sequence, New folder->New folder (2)->New Folder (n)
    '-Group view doesn't disappear on change folder
    '-Can rename when file extensions are hidden without losing extension
    '-Rename from the shell context menu rename command now works
    '-Added Properties to background menu (right click with no file sel)
    '-Added option to always show extensions or use Explorer pref
    '-Added FileClick, FileRename, and FileExecute (double click/enter) events
    '-Added RefreshView function as View Menu entry and public method
    '-BrowserPath will now manually navigate to the given location (must be folder)
    '-Like in Explorer, encrypted files are shown in green, and compressed files
    ' are shown in blue (added option to use Explorer pref or manual)
    '-Fixed bug where loading a folder caused both this project and Explorer
    ' itself to hang/crash when a rename was attempted.
    (The attachment has been removed, this project has advanced to its first major release and is now in the CodeBank)
    Last edited by fafalone; Oct 8th, 2017 at 12:33 AM.

  2. #2
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    278

    Re: Shell Browser UserControl; development/feedback/beta

    Not sure if I am not doing it right. I can't get it going.

    ShellBrowse.vbp is missing mListViewAndHeader.bas

    Demo Project1.vbp crash in HandleListViewSubclass
    Call SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATHW, StrPtr(tOld.sFullPath), StrPtr(tNew.sFullPath))

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: Shell Browser UserControl; development/feedback/beta

    That module isn't needed anyone; I removed it from the demo project but must have forgotten to remove the reference in the CTL project.

    That line should only even be executed after renaming a file... what's the crash say? Is the file renamed (check in Explorer)? It's not essential if you want to comment it out for now; it just notifies Windows that you've renamed a file so that any other Explorer windows are updated immediately instead of next time the folder is opened or refreshed.

  4. #4
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    278

    Re: Shell Browser UserControl; development/feedback/beta

    It crashes immediately upon launch. No error message. Both IDE and the blank Form1 are non respsonsive and I have to End it using Task Manager. Because it happened so quickly, there was no time for me to rename any file.

    After, I did a Find in Current Project for SHCNE_RENAMEITEM and SHCNF_PATHW and can't find any.

    Name:  2017-09-28_112049.jpg
Views: 424
Size:  18.9 KB
    Last edited by chosk; Sep 27th, 2017 at 10:34 PM.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: Shell Browser UserControl; development/feedback/beta

    Did you update the reference to point to your copy of oleexp.tlb? That's gotta be done before you even open the form in the IDE- right after you open the project. (the listview and buttons should show up in the IDE too by the way, just empty).

    There does seem to be a problem with renaming now though; it was working not sure how it stopped working when I hadn't changed anything.. but that's an error that happens when LVN_ENDLABELEDIT comes in.
    Edit: I could have sworn it was working before but apparently it's not possible to use IFileOperation from within a subclass procedure. Call code from a command button on the UserControl? works. Identical code called during endlabeledit? Boom. Weird.
    Last edited by fafalone; Sep 28th, 2017 at 02:21 AM.

  6. #6
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    278

    Re: Shell Browser UserControl; development/feedback/beta

    Quote Originally Posted by fafalone View Post
    Did you update the reference to point to your copy of oleexp.tlb? That's gotta be done before you even open the form in the IDE- right after you open the project. (the listview and buttons should show up in the IDE too by the way, just empty).
    Yes, of course I did update the reference to oleexp.tlb to point to SysWOW64 where I put the oleexp.tlb. This is the first error when I open the project.

    To be sure jus a few miniutes ago, I just re-download your zip again and do manual change in the Project.vbp using a notepad so that all okay before I open the project.vbp.

    Reference=*\G{F9015E81-CAAC-45C0-94E8-42B7DA5D7557}#4.2#0#..\..\..\..\..\Windows\SysWow64\oleexp.tlb#OLEEXP - olelib With Modern Interfaces by fafalone, v4.2
    The screen shot I posted earlier was the crash, not in the IDE. Here is screenshot of the FORM1 in the IDE:
    Attachment 152291

  7. #7
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    278

    Re: Shell Browser UserControl; development/feedback/beta

    There were 9 views of the zip file. This was possibly 9 downloads, including me. It just turned 10 because I re-downloaded again. I wonder whether I am the only one experiencing this problem.

    I hope there are more input to this "development/feedback/beta" thread as in the thread header.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: Shell Browser UserControl; development/feedback/beta

    I get an error with that attachment.
    Incidentally I just had a HD crash so I'm on a fresh windows install, fresh VB install, and the files downloaded from my post here so I should be seeing the problem. What OS are you on, Win7 right?
    Does the 'References' dialog confirm that the oleexp reference is correct? (I've had it say 'MISSING' despite pointing to the right location before, so I always go through the dialog to correct it).

    Form1 (in the IDE) should show an empty ListView with the Name/Size/Type/Date column headers (but no items)
    Last edited by fafalone; Sep 28th, 2017 at 01:52 AM.

  9. #9
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    278

    Re: Shell Browser UserControl; development/feedback/beta

    Yes, I am on Win7 x64.

    Form1 show complete in the IDE per my previous post #6. There was a problem with the forum when I made that post so the IDE scceenshot was an attachment. Now I try inline same screenshot.

    I add in the Const for SHCNE_RENAMEITEM and SHCNF_PATHW and now it choke at SHChangeNotify same line. I think you have to Declare SHChangeNotify and provide the Const for SHCNE_RENAMEITEM and SHCNF_PATHW.
    Attached Images Attached Images  

  10. #10
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    278

    Re: Shell Browser UserControl; development/feedback/beta

    Quote Originally Posted by fafalone View Post
    Does the 'References' dialog confirm that the oleexp reference is correct? (I've had it say 'MISSING' despite pointing to the right location before, so I always go through the dialog to correct it).
    I think it did, but then mine is in SysWOW64. But I manually edited the Project.vbp and it is okay. But the crash still happen.

  11. #11

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: Shell Browser UserControl; development/feedback/beta

    SHChangeNotify and the constants it uses are declared in the typelib. If it was something like that I'd get the error too; I'm using the copy of the project from this thread. And that line isn't even being executed; it's triggered by an action it doesn't run on startup.

    Can you add some debug outputs to trace where exactly the crash is happening? It would have to be somewhere in the initialization code in the Ambient.Usermode block, since it's working in the IDE.
    Sorry to ask you to do that, but despite running the same OS and copies of the files (I even had to re-DL oleexp.tlb from that thread, since I have to wait for a HD delivery to restore my backups), I can't replicate the issue.

  12. #12
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    278

    Re: Shell Browser UserControl; development/feedback/beta

    Quote Originally Posted by fafalone View Post
    SHChangeNotify and the constants it uses are declared in the typelib.
    Solved. My mistake - I missed the version requirement in the first post. I was still having oleexp.tlb version 4.2. Did not realize the new version 4.3 of 12-Sep. Replaced it and now no crash.

    Sorry.
    Last edited by chosk; Sep 28th, 2017 at 02:27 AM.

  13. #13

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: Shell Browser UserControl; development/feedback/beta

    No problem, glad it's working. The SHChangeNotify defs weren't there in 4.2, so that was indeed the problem.




    Very weird bug right now. File renaming actually does work, but only for the last file in the folder!! Windows Explorer hangs too if you try to rename a file in that folder after the project has been run and that folder loaded (and continuing after the project exits, until VB is closed).
    This one's a head scratcher.

    Nevermind, found the problem. Running the enum, there was some kind of access to the file... not a traditional lock as things froze instead of errored, but some kind of lock... and it wasn't freed when the object pointing to the file was set to the next item in the enum like is normally the case. It was resolved by manually releasing everything before moving on to the next item in the enum (Set x = Nothing for each interface before Loop)
    Last edited by fafalone; Sep 28th, 2017 at 07:49 AM.

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: Shell Browser UserControl; development/feedback/beta

    Project updated

    Beta 2
    Code:
    '------------------------------CHANGELOG------------------------------
    '0.2
    '-Added New Folder support, autostarts a rename like Explorer, and will
    ' pick next name in sequence, New folder->New folder (2)->New Folder (n)
    '-Group view doesn't disappear on change folder
    '-Can rename when file extensions are hidden without losing extension
    '-Rename from the shell context menu rename command now works
    '-Added Properties to background menu (right click with no file sel)
    '-Added option to always show extensions or use Explorer pref
    '-Added FileClick, FileRename, and FileExecute (double click/enter) events
    '-Added RefreshView function as View Menu entry and public method
    '-BrowserPath will now manually navigate to the given location (must be folder)
    '-Like in Explorer, encrypted files are shown in green, and compressed files
    ' are shown in blue (added option to use Explorer pref or manual)
    '-Fixed bug where loading a folder caused both this project and Explorer
    ' itself to hang/crash when a rename was attempted.
    Just about ready for the CodeBank, but still wanted feedback. There's a few complexities I've been holding off on implementing... a full thumbnail view (using the code from my ThumbsEx project), file system monitoring (SHChangeNotifyRegister to catch file actions to keep the open folder current), and active drop dragovers (folders and zip files are highlighted as you drag over; using code from the extended cDropTarget dev thread). Also considering a statusbar, which shouldn't be too bad since it's already carrying a depend on Comctrl v6 ocx (for the extended props listview). But if there's any other small features anyone thinks ought to be included, let me know.
    Edit: Thumbnail view was easier and stabler than expected, and will be in the next release

    Update 10/6/2017
    Still working; went a little crazy with features. Also added a preview pane (uses IPreviewHandler so can display pdfs/office docs/videos/fonts/etc, +manually generated image previews), and a status bar showing # of files and total size, as well as help tips for the menu. Then completely redesigned the column display system; now it loads the default columns that Explorer shows, so like if you open your Music library, the columns are album/artist/track/title, or if you open Computer it shows drive capacity/free space. (it's on by default but has an option to disable) and more importantly, no more bugs concerning what columns show what value or adding/removing the wrong column. Open With now works.
    Just trying to finish up a couple other things... I'm still leaving those crazy complex things mentioned in the last update for a future release, but did want to finish things like the details bar, although probably just a basic version without edit ability or scaling for the first release.
    Should post the first codebank version this week.

    Update 10/8/2017
    This project is now on its first major release. Please continue all discussion in the CodeBank project thread.
    Last edited by fafalone; Oct 8th, 2017 at 12:35 AM.

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