Results 1 to 8 of 8

Thread: [2005] Shell32.FolderView control: The saga continues...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    [2005] Shell32.FolderView control: The saga continues...

    I'm looking for a way to implement the FolderView control (the file list control used for folders, open, and save as windows) for a custom Open window I'm working on for my program. (No worries... though it is custom, it will fit most of the windows standards).

    I tried a trick I know which is to use a webbrowser control and set its url to a specific folder, but there's no way to filter the files shown (i.e. by extension).

    I need to maintain that windows look and want to also maintain the explorer look. I also want to maintain the special folders (i.e. network places). The icons should also use the correct associated icon (i.e. If a thumnail handler is installed, show the thumbnail in place of the icon.)

    I'm more interested in using the built in windows control (i.e. Shell32.FolderView) than a third party control (even if free). I can't figure out how to instanciate Shell32.FolderView as a control on the form.
    Last edited by agent; Jul 11th, 2006 at 11:30 PM.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: [2005] Shell32.FolderView control

    Still unresolved.

    I found a c++ wtl sample that does this at http://www.codeproject.com/shell/explorer.asp

    Can this be done in .Net at all? Should I be writing the control in c++ wtl? (This would add several months to my project as I don't really understands c++ or wtl)

  3. #3
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: [2005] Shell32.FolderView control

    My.Computer.FileSystem.SpecialDirectories will have some of the directories you are looking for... and My.Computer.FileSystem will have some of the access you need. I would imagine that anything not immediately available through there you will need to emulate in some form... Windows only appears simple to the end user, but there'll be a lot of things underneath that you'll need to write if you want to emulate the windows explorer...

    Hope that helps in some form.
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: [2005] Shell32.FolderView control

    That's one of the reasons I wanted to avoid emulating it and go with the real thing. The sample I provided in my previous post manages to get the actual control. It would save me from having to write ALL the code to support all the features (i.e. drag and drop, file context menus, etc).

    Take a look in the MSDN at SHCreateShellFolderView and you'll see approximatley what I'm trying to do. The second param requires a reference to a IShellView object. I'm having the darnedest time finding a lib that exports it as a COM interface or a .Net interface. My only guess would be shell3d.dll but the object browser says otherwise.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: [2005] Shell32.FolderView control

    More news from the ongong saga of using the IShellView interface from .Net.

    OK, Apparently, adding a reference to shell32.dll isn't exactly the right way to go. I found an outdated book on writing shell extensions in vb6 for windows 98 to see how they got a reference to IUnknown and other interfaces that are seemingly hard to get at. Visual Basic Shell Programming from O'Reilly (isbn 1-56592-670-6) mentions that they wrote a custom TLB file (VBShell.TLB) that is available for free from their website.

    After downloading it, I discovered that while the more common interfaces (i.e. IContextMenu) are provided in the tlb, other things useful for what I'm trying to do are not.

    Does anyone know of an open source tlb for getting access to the shell interfaces? Or will I be writing my own? Is there something I'm not considering here?

    My plan is to wrap a control class around the SHCreateShellFolderView api function which supplies a reference to an IShellView object.

  6. #6
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    Re: [2005] Shell32.FolderView control: The saga continues...

    Ask and you shall recieve... something. Hopefully that's what you're looking for.
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: [2005] Shell32.FolderView control: The saga continues...

    I actually discovered that vb classic example just before you posted this. In particular, I downloaded the sample at http://btmtz.mvps.org/enumdeskvb/

    It does exactly what I want. Now I have to convert it to .Net and wrap it in a control.

    If anybody knows offhand how to filter the files listed (at least by wildcard, but preferably arbitrarily) please speak up and save poor Agent here from a lot more research. My head hurts.

    Now the real work begins (translating and wrapping).

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: [2005] Shell32.FolderView control: The saga continues...

    After reviewing the code in the example I posted above, I discovered that it also emulates the FolderView window. As my goal is to avoid emulation and let windows do the control itself, I'm not going to wrap that code into a control.

    Basically, all it does is creates a ListView and TreeView using the CreateWindowEx function and populate it with the entire Shell namespace. It also implements the shell context menu.

    The reason I want to avoid emulation is that in future versions of windows, Microsoft may significantly change the behavior of the FolderView control without changing the method of creation and interaction (i.e. it'll use the same interfaces and classes).

    When this happens, I want my program's control's updated thus.

    New direction for project: Anybody know where I can get a tlb that has ALL of the shell interfaces, including the hard to find IShellBrowser interface? I say hard to find because while I now have several shell related tlbs registered on my system, none seem to have IShellBrowser.

    I am aware that the MSDN says you don't need to implement it. My program emulates (with much added functionality) a common shell window and needs to implement IShellBrowser to function properly.

    Why, oh why couldn't Microsoft add ALL of the shell interface defs to shell32.dll?

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