none
Windows File Explorer clone RRS feed

  • Question

  • Hi

    Looking to create a very basic version of File Explorer

    Not necessarily a clone per say, but a file explorer which I can run in my Windows PE environment for recovering files etc

    I don't need much other than ability to view files/folders, copy/paste and preferably drag/drop so I can easily move/copy files/folders, and progress display for copying/moving files/folders

    I like the idea of having a dual pane view (bit like total commander I believe) so I can see two locations in one window to make copying/moving easier

    See screenshot for rough mockup

    Reason for asking on here is twofold,

    1) Firstly to see if anyone else created something similar and has any comments/ ideas

    2) and secondly probably mainly for someone such as Frank who may some ideas relating to using DevExpress controls to achieve this?

    I have looked at existing components as well such as Shell MegaPack, ShellBrowser .NET Components and Exontrol components and had varying degrees of success, the best looks to be Shell MegaPack, but not been updated for years


    Darren Rose

    Thursday, January 4, 2018 10:40 PM

All replies

  • You can use the IExplorerBrowser interface (Explorer embedded inside a window)

    (I had posted a basic sample in this thread)


    • Edited by Castorix31 Friday, January 5, 2018 12:46 AM
    Friday, January 5, 2018 12:45 AM
  • Darren,

    I see that you've mentioned me but I don't know anything about Windows PE. I don't know what framework even works with it for that matter.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 10:34 AM
  • Darren,

    I see that you've mentioned me but I don't know anything about Windows PE. I don't know what framework even works with it for that matter.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    @Frank

    It being PE doesn't really matter to be honest as it runs all .NET programs I have tested so far including DevExpress components - so if it works in Windows normally it will work in PE


    Darren Rose

    Friday, January 5, 2018 10:37 AM

  • @Frank

    It being PE doesn't really matter to be honest as it runs all .NET programs I have tested so far including DevExpress components - so if it works in Windows normally it will work in PE


    Darren Rose

    Ok, then given that, if you go to your screenshot, consider creating a UserControl for half of it (the left or right side).

    With that you can do pretty much anything you want and eventually, put two of them side-by-side.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 10:42 AM
  • Yes that make sense and I have used UserControls before

    So what are best components to use to simulate the tree view for the left pane and file view for right pane

    Another important requirement is a "search" facility, so can quickly/easily search for files using variety of criteria


    Darren Rose

    Friday, January 5, 2018 10:46 AM
  • Yes that make sense and I have used UserControls before

    So what are best components to use to simulate the tree view for the left pane and file view for right pane

    Another important requirement is a "search" facility, so can quickly/easily search for files using variety of criteria


    Darren Rose

    You don't need any component.

    As said above, the IExplorerBrowser does everything. Just test it.

    Friday, January 5, 2018 10:49 AM
  • Yes that make sense and I have used UserControls before

    So what are best components to use to simulate the tree view for the left pane and file view for right pane

    Another important requirement is a "search" facility, so can quickly/easily search for files using variety of criteria


    Darren Rose

    It's not even five in the morning here - barely got coffee making but for the tree view, use a TreeList control and set it for just one column. Then it becomes a "Dev" version of a standard treelist but it has all of their methods and skinning, etc..

    For the other side, I used a grid control and set the "Find" to always be on. You might want to ask Dev for their suggestion though.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 10:51 AM
  • You don't need any component.

    As said above, the IExplorerBrowser does everything. Just test it.

    Exactly.

    No need to re-invent the wheel...

    Friday, January 5, 2018 10:55 AM
  • @Castorix31

    @valet

    Sorry thought I had already responded to your suggestion

    This doesn't work under Windows PE as a) only shows me as per screenshot and b) none of the drives or folders are clickable

    This is why I do need to "re-invent the wheel" and hence my further discussion about it

    But thank you so much for your replies - handy to know for other projects


    Darren Rose

    Friday, January 5, 2018 12:20 PM
  • It's not even five in the morning here - barely got coffee making but for the tree view, use a TreeList control and set it for just one column. Then it becomes a "Dev" version of a standard treelist but it has all of their methods and skinning, etc..

    For the other side, I used a grid control and set the "Find" to always be on. You might want to ask Dev for their suggestion though.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Sorry I will leave you to your coffee!!

    Okay I will take a look - does the "Find" then allow me to search through all files/folders

    How do I link up these controls to then show drives/files/folders etc

    Excuse all questions


    Darren Rose

    Friday, January 5, 2018 12:22 PM
  • Okay I will take a look - does the "Find" then allow me to search through all files/folders

    This describes the "find":

    https://documentation.devexpress.com/WindowsForms/8869/Controls-and-Libraries/Data-Grid/Visual-Elements/Grid-Control-Elements/Find-Panel

    When you set it up, you can choose which field(s) it finds for but the default is all fields.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 12:29 PM
  • Darren,

    In their latest release (17.2.2) they have added several things, one which looks similar to what you showed earlier:

    https://documentation.devexpress.com/WindowsForms/DevExpress.XtraEditors.XtraOpenFileDialog.class

    Something to consider.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 12:35 PM
  • Okay I will take a look - does the "Find" then allow me to search through all files/folders

    This describes the "find":

    https://documentation.devexpress.com/WindowsForms/8869/Controls-and-Libraries/Data-Grid/Visual-Elements/Grid-Control-Elements/Find-Panel

    When you set it up, you can choose which field(s) it finds for but the default is all fields.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Yes this just does a find of what is currently displayed in the grid control - and yes I use that in other projects

    It doesn't though give me a "search" facility to search through my whole C: drive for example does it


    Darren Rose

    Friday, January 5, 2018 12:48 PM
  • Darren,

    In their latest release (17.2.2) they have added several things, one which looks similar to what you showed earlier:

    https://documentation.devexpress.com/WindowsForms/DevExpress.XtraEditors.XtraOpenFileDialog.class

    Something to consider.


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    Yes these new controls replace then standard open file / open folder dialogs with new Dev skinnable versions - just used for save/load buttons or opening files etc, not as a file explorer

    Darren Rose

    Friday, January 5, 2018 12:48 PM

  • Yes this just does a find of what is currently displayed in the grid control - and yes I use that in other projects

    It doesn't though give me a "search" facility to search through my whole C: drive for example does it


    Darren Rose

    It's only looking through whatever datasource the grid's currently displaying.

    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 12:51 PM


  • Yes these new controls replace then standard open file / open folder dialogs with new Dev skinnable versions - just used for save/load buttons or opening files etc, not as a file explorer

    Darren Rose

    But look at it again: They've built nearly the whole thing you're asking for, so somewhere, they have it or hopefully can/will tell you how to proceed.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 12:52 PM


  • Yes these new controls replace then standard open file / open folder dialogs with new Dev skinnable versions - just used for save/load buttons or opening files etc, not as a file explorer

    Darren Rose

    But look at it again: They've built nearly the whole thing you're asking for, so somewhere, they have it or hopefully can/will tell you how to proceed.


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    Yes I have looked at it - I use it in several apps and it doesn't do what I want as far as I can see - as it is just an open file or open folder dialog, that you pop-up to select a file/folder in same way as standard vb controls (openfiledialog, savefiledialog and folderbrowserdialog) - they are popup windows not controls that I can put on a form and then use as "browsers" to browse my filesystem, move/copy files, search etc

    Darren Rose

    Friday, January 5, 2018 12:56 PM

  • Yes this just does a find of what is currently displayed in the grid control - and yes I use that in other projects

    It doesn't though give me a "search" facility to search through my whole C: drive for example does it


    Darren Rose

    It's only looking through whatever datasource the grid's currently displaying.

    "A problem well stated is a problem half solved.” - Charles F. Kettering


    okay so might work, but still don't get how I "bind" a grid to my hard drive to show files/folders - only ever used it to bind to a data source such as database, data table etc

    Darren Rose

    Friday, January 5, 2018 12:57 PM
  • Might be something you could start with and add the functionality you need:

    https://www.codeproject.com/Articles/8546/An-All-VB-NET-Explorer-Tree-Control-with-ImageList


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, January 5, 2018 12:59 PM

  • okay so might work, but still don't get how I "bind" a grid to my hard drive to show files/folders - only ever used it to bind to a data source such as database, data table etc

    Darren Rose

    A BindingSource is made for this:

    https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/bindingsource-component-overview

    That's somewhat "high-level" but it gives you a good idea I hope.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 1:02 PM
  • A BindingSource is made for this:

    https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/bindingsource-component-overview

    That's somewhat "high-level" but it gives you a good idea I hope.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Okay I will research further, but from that link and a google- I still cannot see how you use a "filesystem" as the data / binding source, all examples point to use a database/datatable etc as a datasource

    Darren Rose

    Friday, January 5, 2018 1:17 PM
  • Darren,

    This might get you started but it's only a start. You'll next want to check the attributes but you can do all of that with the base class that both DirectoryInfo and FileInfo use:

    FileSystemInfo

    You can see in the example that it will get both directories (sub-directories) as instances of DirectoryInfo and it will also get instances of files as instances of FileInfo.

    That's a good start with what you're building.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 1:18 PM
  • Darren,

    This might get you started but it's only a start. You'll next want to check the attributes but you can do all of that with the base class that both DirectoryInfo and FileInfo use:

    FileSystemInfo

    You can see in the example that it will get both directories (sub-directories) as instances of DirectoryInfo and it will also get instances of files as instances of FileInfo.

    That's a good start with what you're building.


    "A problem well stated is a problem half solved.” - Charles F. Kettering


    Thanks, have use that class before for other things, still not sure how it relates to showing and browsing drive via dev grid etc, but will keep playing

    Darren Rose

    Friday, January 5, 2018 1:20 PM
  • Might be something you could start with and add the functionality you need:

    https://www.codeproject.com/Articles/8546/An-All-VB-NET-Explorer-Tree-Control-with-ImageList


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Thanks Paul - will take a look - reading the comments I found a newer version of it at link below, so might be useful :)

    https://www.codeproject.com/Articles/422497/ExpTreeLib-Version-Explorer-like-Navigation-and


    Darren Rose

    Friday, January 5, 2018 1:30 PM

  • Okay I will research further, but from that link and a google- I still cannot see how you use a "filesystem" as the data / binding source, all examples point to use a database/datatable etc as a datasource

    Darren Rose

    Class Diagram

    The way I did it was by creating a DataTable and then binding the BindingSource to that DataTable.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 1:38 PM
  • It's only looking through whatever datasource the grid's currently displaying.

    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Found a demo in the DevExpress folder which uses the GridControl with WinExplorerView and shows file system - and confirmed the find only searches entries visible on screen at the time - NOT the whole file system

    Demo located in following folder for reference (change 17.2 to version you have installed) = C:\Users\Public\Documents\DevExpress Demos 17.2\Components\WinForms\VB\GridMainDemo


    Darren Rose

    Friday, January 5, 2018 3:26 PM
  • ... and confirmed the find only searches entries visible on screen at the time - NOT the whole file system

    I think they might be doing something that's internal to the grid. A few years ago, their grid was data-bound only but now they allow partially unbound (and maybe even fully unbound).

    The "find" worked the same both before and afterward though.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 4:00 PM
  • I think they might be doing something that's internal to the grid. A few years ago, their grid was data-bound only but now they allow partially unbound (and maybe even fully unbound).

    The "find" worked the same both before and afterward though.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    okay

    it has been one of those days where I am now no further forward than I was 8 hours ago

    still no idea how to achieve what I want

    thinking a third party component like I mentioned above might work best, as already has find, copy/paste, drag/drop integrated as part of it - might be easier


    Darren Rose

    Friday, January 5, 2018 4:08 PM

  • still no idea how to achieve what I want

    thinking a third party component like I mentioned above might work best, as already has find, copy/paste, drag/drop integrated as part of it - might be easier


    Darren Rose

    Using Dev's (or anyone's) stuff complicates things.

    In the end, it's a better product but it definitely takes longer to get there.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Friday, January 5, 2018 4:11 PM
  • This doesn't work under Windows PE

    If IExplorerBrowser doesn't work on PE, maybe you can test an interface like INameSpaceTreeControl

    which creates a TreeView with the Shell Namespace, like Explorer.

    I tested on Windows 10 but I don't know for Windows PE...

    A simple test with 1 "NameSpaceTreeControl" control only inside a Form  =>

    Public Class Form1                                                                                                                                                                                                                                                                                        
        Public Enum HRESULT As Integer                                                                                                                                                                                                                                                                        
            S_OK = 0                                                                                                                                                                                                                                                                                          
            S_FALSE = 1                                                                                                                                                                                                                                                                                       
            E_NOINTERFACE = &H80004002                                                                                                                                                                                                                                                                        
            E_NOTIMPL = &H80004001                                                                                                                                                                                                                                                                            
            E_FAIL = &H80004005                                                                                                                                                                                                                                                                               
        End Enum                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                              
        <StructLayout(LayoutKind.Sequential)>                                                                                                                                                                                                                                                                 
        Public Structure RECT                                                                                                                                                                                                                                                                                 
            Public Left As Integer                                                                                                                                                                                                                                                                            
            Public Top As Integer                                                                                                                                                                                                                                                                             
            Public Right As Integer                                                                                                                                                                                                                                                                           
            Public Bottom As Integer                                                                                                                                                                                                                                                                          
        End Structure                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                              
        Public Enum NSTCSTYLE As Integer                                                                                                                                                                                                                                                                      
            NSTCS_HASEXPANDOS = &H1                                                                                                                                                                                                                                                                           
            NSTCS_HASLINES = &H2                                                                                                                                                                                                                                                                              
            NSTCS_SINGLECLICKEXPAND = &H4                                                                                                                                                                                                                                                                     
            NSTCS_FULLROWSELECT = &H8                                                                                                                                                                                                                                                                         
            NSTCS_SPRINGEXPAND = &H10                                                                                                                                                                                                                                                                         
            NSTCS_HORIZONTALSCROLL = &H20                                                                                                                                                                                                                                                                     
            NSTCS_ROOTHASEXPANDO = &H40                                                                                                                                                                                                                                                                       
            NSTCS_SHOWSELECTIONALWAYS = &H80                                                                                                                                                                                                                                                                  
            NSTCS_NOINFOTIP = &H200                                                                                                                                                                                                                                                                           
            NSTCS_EVENHEIGHT = &H400                                                                                                                                                                                                                                                                          
            NSTCS_NOREPLACEOPEN = &H800                                                                                                                                                                                                                                                                       
            NSTCS_DISABLEDRAGDROP = &H1000                                                                                                                                                                                                                                                                    
            NSTCS_NOORDERSTREAM = &H2000                                                                                                                                                                                                                                                                      
            NSTCS_RICHTOOLTIP = &H4000                                                                                                                                                                                                                                                                        
            NSTCS_BORDER = &H8000                                                                                                                                                                                                                                                                             
            NSTCS_NOEDITLABELS = &H10000                                                                                                                                                                                                                                                                      
            NSTCS_TABSTOP = &H20000                                                                                                                                                                                                                                                                           
            NSTCS_FAVORITESMODE = &H80000                                                                                                                                                                                                                                                                     
            NSTCS_AUTOHSCROLL = &H100000                                                                                                                                                                                                                                                                      
            NSTCS_FADEINOUTEXPANDOS = &H200000                                                                                                                                                                                                                                                                
            NSTCS_EMPTYTEXT = &H400000                                                                                                                                                                                                                                                                        
            NSTCS_CHECKBOXES = &H800000                                                                                                                                                                                                                                                                       
            NSTCS_PARTIALCHECKBOXES = &H1000000                                                                                                                                                                                                                                                               
            NSTCS_EXCLUSIONCHECKBOXES = &H2000000                                                                                                                                                                                                                                                             
            NSTCS_DIMMEDCHECKBOXES = &H4000000                                                                                                                                                                                                                                                                
            NSTCS_NOINDENTCHECKS = &H8000000                                                                                                                                                                                                                                                                  
            NSTCS_ALLOWJUNCTIONS = &H10000000                                                                                                                                                                                                                                                                 
            NSTCS_SHOWTABSBUTTON = &H20000000                                                                                                                                                                                                                                                                 
            NSTCS_SHOWDELETEBUTTON = &H40000000                                                                                                                                                                                                                                                               
            NSTCS_SHOWREFRESHBUTTON = &H80000000                                                                                                                                                                                                                                                              
        End Enum                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                              
        Public Enum SHCONTF As Integer                                                                                                                                                                                                                                                                        
            SHCONTF_CHECKING_FOR_CHILDREN = &H10                                                                                                                                                                                                                                                              
            SHCONTF_FOLDERS = &H20                                                                                                                                                                                                                                                                            
            SHCONTF_NONFOLDERS = &H40                                                                                                                                                                                                                                                                         
            SHCONTF_INCLUDEHIDDEN = &H80                                                                                                                                                                                                                                                                      
            SHCONTF_INIT_ON_FIRST_NEXT = &H100                                                                                                                                                                                                                                                                
            SHCONTF_NETPRINTERSRCH = &H200                                                                                                                                                                                                                                                                    
            SHCONTF_SHAREABLE = &H400                                                                                                                                                                                                                                                                         
            SHCONTF_STORAGE = &H800                                                                                                                                                                                                                                                                           
            SHCONTF_NAVIGATION_ENUM = &H1000                                                                                                                                                                                                                                                                  
            SHCONTF_FASTITEMS = &H2000                                                                                                                                                                                                                                                                        
            SHCONTF_FLATLIST = &H4000                                                                                                                                                                                                                                                                         
            SHCONTF_ENABLE_ASYNC = &H8000                                                                                                                                                                                                                                                                     
            SHCONTF_INCLUDESUPERHIDDEN = &H10000                                                                                                                                                                                                                                                              
        End Enum                                                                                                                                                                                                                                                                                              
        Public Enum NSTCROOTSTYLE As Integer                                                                                                                                                                                                                                                                  
            NSTCRS_VISIBLE = 0                                                                                                                                                                                                                                                                                
            NSTCRS_HIDDEN = &H1                                                                                                                                                                                                                                                                               
            NSTCRS_EXPANDED = &H2                                                                                                                                                                                                                                                                             
        End Enum                                                                                                                                                                                                                                                                                              
        Public Enum NSTCITEMSTATE As Integer                                                                                                                                                                                                                                                                  
            NSTCIS_NONE = 0                                                                                                                                                                                                                                                                                   
            NSTCIS_SELECTED = &H1                                                                                                                                                                                                                                                                             
            NSTCIS_EXPANDED = &H2                                                                                                                                                                                                                                                                             
            NSTCIS_BOLD = &H4                                                                                                                                                                                                                                                                                 
            NSTCIS_DISABLED = &H8                                                                                                                                                                                                                                                                             
            NSTCIS_SELECTEDNOEXPAND = &H10                                                                                                                                                                                                                                                                    
        End Enum                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                              
        Public Enum NSTCGNI As Integer                                                                                                                                                                                                                                                                        
            NSTCGNI_NEXT = 0                                                                                                                                                                                                                                                                                  
            NSTCGNI_NEXTVISIBLE = 1                                                                                                                                                                                                                                                                           
            NSTCGNI_PREV = 2                                                                                                                                                                                                                                                                                  
            NSTCGNI_PREVVISIBLE = 3                                                                                                                                                                                                                                                                           
            NSTCGNI_PARENT = 4                                                                                                                                                                                                                                                                                
            NSTCGNI_CHILD = 5                                                                                                                                                                                                                                                                                 
            NSTCGNI_FIRSTVISIBLE = 6                                                                                                                                                                                                                                                                          
            NSTCGNI_LASTVISIBLE = 7                                                                                                                                                                                                                                                                           
        End Enum                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                              
        <ComImport>                                                                                                                                                                                                                                                                                           
        <Guid("028212A3-B627-47e9-8856-C14265554E4F")>                                                                                                                                                                                                                                                        
        <InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>                                                                                                                                                                                                                                                 
        Public Interface INameSpaceTreeControl                                                                                                                                                                                                                                                                
            Function Initialize(hwndParent As IntPtr, ByRef prc As RECT, nsctsFlags As NSTCSTYLE) As HRESULT                                                                                                                                                                                                  
            Function TreeAdvise(punk As IntPtr, ByVal pdwCookie As Integer) As HRESULT                                                                                                                                                                                                                        
            Function TreeUnadvise(pdwCookie As Integer) As HRESULT                                                                                                                                                                                                                                            
            Function AppendRoot(psiRoot As IntPtr, grfEnumFlags As SHCONTF, grfRootStyle As NSTCROOTSTYLE, pif As IntPtr) As HRESULT                                                                                                                                                                          
            Function InsertRoot(iIndex As Integer, psiRoot As IntPtr, grfEnumFlags As SHCONTF, grfRootStyle As NSTCROOTSTYLE, pif As IntPtr) As HRESULT                                                                                                                                                       
            Function RemoveRoot(psiRoot As IntPtr) As HRESULT                                                                                                                                                                                                                                                 
            Function RemoveAllRoots() As HRESULT                                                                                                                                                                                                                                                              
            Function GetRootItems(ByVal ppsiaRootItems As IntPtr) As HRESULT                                                                                                                                                                                                                                  
            Function SetItemState(psi As IntPtr, nstcisMask As NSTCITEMSTATE, nstcisFlags As NSTCITEMSTATE) As HRESULT                                                                                                                                                                                        
            Function GetItemState(psi As IntPtr, nstcisMask As NSTCITEMSTATE, ByVal pnstcisFlags As NSTCITEMSTATE) As HRESULT                                                                                                                                                                                 
            Function GetSelectedItems(ByVal psiaItems As IntPtr) As HRESULT                                                                                                                                                                                                                                   
            Function GetItemCustomState(psi As IntPtr, ByVal piStateNumber As Integer) As HRESULT                                                                                                                                                                                                             
            Function SetItemCustomState(psi As IntPtr, iStateNumber As Integer) As HRESULT                                                                                                                                                                                                                    
            Function EnsureItemVisible(psi As IntPtr) As HRESULT                                                                                                                                                                                                                                              
            Function SetTheme(pszTheme As String) As HRESULT                                                                                                                                                                                                                                                  
            Function GetNextItem(psi As IntPtr, nstcgi As NSTCGNI, ByVal ppsiNext As IntPtr) As HRESULT                                                                                                                                                                                                       
            Function HitTest(ppt As Point, nstcgi As NSTCGNI, ByVal ppsiOut As IntPtr) As HRESULT                                                                                                                                                                                                             
            Function GetItemRect(psi As IntPtr, ByRef prect As RECT) As HRESULT                                                                                                                                                                                                                               
            Function CollapseAll() As HRESULT                                                                                                                                                                                                                                                                 
        End Interface                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                              
        Public CSIDL_DESKTOP As Integer = 0                                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                                              
        <DllImport("Shell32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>                                                                                                                                                                                                                                 
        Public Shared Function SHGetFolderLocation(ByVal hwndOwner As IntPtr, ByVal nFolder As Integer, ByVal hToken As IntPtr, ByVal dwReserved As UInteger, <Out> ByRef ppidl As IntPtr) As HRESULT                                                                                                         
        End Function                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              
        <DllImport("Shell32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>                                                                                                                                                                                                                                 
        Public Shared Function SHCreateItemFromIDList(ByVal pidl As IntPtr, <[In], MarshalAs(UnmanagedType.LPStruct)> ByVal riid As Guid, <Out> ByRef ppv As IntPtr) As HRESULT                                                                                                                               
        End Function                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              
        <DllImport("User32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>                                                                                                                                                                                                                                  
        Public Shared Function MoveWindow(hWnd As IntPtr, X As Integer, Y As Integer, nWidth As Integer, nHeight As Integer, bRepaint As Boolean) As Boolean                                                                                                                                                  
        End Function                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              
        <DllImport("User32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>                                                                                                                                                                                                                                  
        Public Shared Function FindWindowEx(ByVal hWndParent As IntPtr, ByVal hWndChildAfter As IntPtr, ByVal lpszClass As String, ByVal lpszWindow As String) As IntPtr                                                                                                                                      
        End Function                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              
        <DllImport("Ole32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>                                                                                                                                                                                                                                   
        Public Shared Function OleInitialize(pvReserved As IntPtr) As HRESULT                                                                                                                                                                                                                                 
        End Function                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                              
        Dim pNameSpaceTreeControl As INameSpaceTreeControl                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                 
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load                                                                                                                                                                                                                          
            OleInitialize(IntPtr.Zero)                                                                                                                                                                                                                                                                        
            Dim CLSID_NamespaceTreeControl As New Guid("AE054212-3535-4430-83ED-D501AA6680E6")                                                                                                                                                                                                                
            Dim NameSpaceTreeControlType As Type = Type.GetTypeFromCLSID(CLSID_NamespaceTreeControl, True)                                                                                                                                                                                                    
            Dim NameSpaceTreeControl As Object = Activator.CreateInstance(NameSpaceTreeControlType)                                                                                                                                                                                                           
            pNameSpaceTreeControl = DirectCast(NameSpaceTreeControl, INameSpaceTreeControl)                                                                                                                                                                                                                   
            Dim hr As HRESULT = pNameSpaceTreeControl.Initialize(Me.Handle, Nothing, NSTCSTYLE.NSTCS_RICHTOOLTIP Or NSTCSTYLE.NSTCS_FAVORITESMODE Or NSTCSTYLE.NSTCS_FULLROWSELECT Or NSTCSTYLE.NSTCS_NOREPLACEOPEN Or NSTCSTYLE.NSTCS_AUTOHSCROLL Or NSTCSTYLE.NSTCS_HASEXPANDOS Or NSTCSTYLE.NSTCS_HASLINES)
            If (hr = HRESULT.S_OK) Then                                                                                                                                                                                                                                                                       
                Dim pidl As IntPtr = IntPtr.Zero                                                                                                                                                                                                                                                              
                hr = SHGetFolderLocation(IntPtr.Zero, CSIDL_DESKTOP, IntPtr.Zero, 0, pidl)                                                                                                                                                                                                                    
                If (hr = HRESULT.S_OK) Then                                                                                                                                                                                                                                                                   
                    Dim psi As IntPtr = IntPtr.Zero                                                                                                                                                                                                                                                           
                    Dim GUID_IShellItem As New Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe")                                                                                                                                                                                                                   
                    hr = SHCreateItemFromIDList(pidl, GUID_IShellItem, psi)                                                                                                                                                                                                                                   
                    If (hr = HRESULT.S_OK) Then                                                                                                                                                                                                                                                               
                        hr = pNameSpaceTreeControl.AppendRoot(psi, SHCONTF.SHCONTF_FOLDERS Or SHCONTF.SHCONTF_NONFOLDERS, NSTCROOTSTYLE.NSTCRS_EXPANDED, IntPtr.Zero)                                                                                                                                
                    End If                                                                                                                                                                                                                                                                                    
                End If                                                                                                                                                                                                                                                                                        
            End If                                                                                                                                                                                                                                                                                            
            Me.ClientSize = New Size(800, 600)                                                                                                                                                                                                                                                                
            CenterToScreen()                                                                                                                                                                                                                                                                                  
        End Sub                                                                                                                                                                                                                                                                                               
        Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles Me.Resize                                                                                                                                                                                                                          
            Dim hWndTree As IntPtr = FindWindowEx(Me.Handle, IntPtr.Zero, "NameSpaceTreeControl", Nothing)                                                                                                                                                                                                    
            MoveWindow(hWndTree, 0, 0, Me.ClientSize.Width, Me.ClientSize.Height, True)                                                                                                                                                                                                                       
        End Sub                                                                                                                                                                                                                                                                                               
    End Class                                                                                                                                                                                                                                                                                                 

    Friday, January 5, 2018 8:56 PM
  • @Castorix31

    No unfortunately that doesn't work in PE either - get error below

    Seem to be having more luck using 3rd party controls such as ones I mentioned in first post

    Thanks for helping though

    ************** Exception Text **************
    System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {AE054212-3535-4430-83ED-D501AA6680E6} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
       at System.Activator.CreateInstance(Type type, Boolean nonPublic)
       at System.Activator.CreateInstance(Type type)
       at WindowsApp1.Form1.Form1_Load(Object sender, EventArgs e)
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    
    
    


    Darren Rose

    • Proposed as answer by Wade Harvey Tuesday, April 24, 2018 11:57 PM
    • Unproposed as answer by Wade Harvey Tuesday, April 24, 2018 11:57 PM
    Friday, January 5, 2018 9:17 PM
  • https://www.codeproject.com/Articles/1240640/File-Explorer-Clone-with-Tabs-and-Parallel-File-Se - This article shows how to use Winforms, WPF and C# to create a File Explorer Clone with Tabs. I am not sure how you would copy files or folders from tab to tab.It would have to be rewritten to have two panels instead of tabs.

    Here is a screenshot of the File Explorer Clone in List View:


    (Click to enlarge)

    Here is a screenshot of the File Explorer Clone in Details View:


    (Click to enlarge)

    Background


    Wade Harvey

    Wednesday, April 25, 2018 12:04 AM
  • Thanks, I will take a look

    Darren Rose

    Wednesday, April 25, 2018 9:11 AM