Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Shell extension for compressed files

58 views
Skip to first unread message

David Candy

unread,
Dec 28, 2001, 8:54:01 PM12/28/01
to
You need a namespace extension, and you need to write it.
http://msdn.microsoft.com/library/en-us/shellcc/platform/Shell/shell_intro.asp?frame=true

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------
"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C55ECB9...@hotmail.com...
> I have an application that manages images in specialized database. I
> would like to implement the Compressed Zip Explorer interface to provide
> a view of the image files within my database but cannot seem to find any
> documentation on how Microsoft has implemented compressed zip files as
> folders.
>
> Does anyone know how to change a file into a folder that acts like a
> shell namespace? Microsoft knows how but noone else seems to....
>
> Thanks.
>

David Candy

unread,
Dec 31, 2001, 6:08:03 PM12/31/01
to
This is from the shell programmers guide. Because you're using a file you must root your view as you can't browse into folders from the shell's namespace (as Compressed Folder's opens zips in a new window).

Displaying a Self-Contained View of a Namespace Extension

Most namespace extensions are a subset of the Shell namespace. When you create a junction point, as described in Specifying a Namespace Extension's Location, Microsoft® Windows® Explorer allows users to navigate into and out of your namespace extension just like any other folder. However, it is also possible to use Windows Explorer to display only the contents of your namespace extension. This display option is sometimes referred to as a rooted view. Although not commonly used, rooted views might be preferable to normal views for some types of extensions.

With a rooted view, a new instance of Windows Explorer is created that displays the contents of the extension as a separate namespace. The tree view of a rooted view shows only those folders that are part of the extension. Users cannot navigate from a rooted view to other parts of the Shell namespace.

Extensions are implemented in the same way for rooted views as they are for normal views. The only difference is in the way the contents of the extension are displayed by Windows Explorer. It is even possible to have normal and rooted views of the same extension.

To open a view of an extension, you must launch an instance of Explorer.exe with a /root flag. There are several different ways to launch a rooted view, depending on the nature of your extension.

Using a Junction Point to Open a Rooted View

Typically, clicking or double-clicking the folder that represents a junction point opens a normal view of the contents of the associated extension. However, you can use the registry to specify that browsing into a junction point will open a rooted view. To do so, add Open and Explore command keys to your extension's CLSID registry key.

HKEY_CLASSES_ROOT
  CLSID
    ...
    {Extension CLSID}
      ...
      Shell
        Open
          Command==%SYSTEMROOT% \explorer.exe/e,/root,"%1"
        Explore
          Command==%SYSTEMROOT% \explorer.exe/e,/root,"%1"

When the user clicks or double-clicks the junction point, an instance of Explorer.exe is launched to display the contents of the extension as a rooted view.

Using a Shortcut File to Open a Rooted View

Another approach to launching a rooted view is to create a shortcut file and set the command to Explorer.exe with a /root flag. The exact form the command takes depends on the location of the junction point:

  • If the junction point is a subfolder of the Desktop, use:
    Explorer.exe /e,/root,::{Extension CLSID}
  • If the junction point is a file system folder, use:
    Explorer.exe /e,/root,[Fully qualified path to the folder]
  • If the junction point is a subfolder of a system virtual folder, use:
    Explorer.exe /e,/root,::{Folder CLSID}\::{Extension CLSID}

The system virtual folders that can contain junction points have the following CLSIDs.

My Computer {20D04FE0-3AEA-1069-A2D8-08002B30309D}
My Network Places {208D2C60-3AEA-1069-A2D7-08002B30309D}
Control Panel {21EC2020-3AEA-1069-A2DD-08002B30309D}
Internet Explorer {871C5380-42A0-1069-A2EA-08002B30309D}

Note Systems earlier than Microsoft® Windows® 2000 use a display name of Network Neighborhood instead of My Network Places. However, the CLSID is the same for both.

Displaying a Rooted View of a File

Extensions are usually presented to the user as a folder. However, you can also use an extension to allow users to browse the contents of a file. Extensions of this sort are typically used to display the contents of the members of a file class. For instance, the members of a file class might contain multiple compressed files or images, organized in a hierarchy. Rather than write an application to allow the user to view the contents of such a file, you can instead write a namespace extension and let Windows Explorer handle the display.

You must use a rooted view to have an extension display the contents of a file. The most common way to provide a rooted view of the members of the file class is to define a shortcut menu verb that launches an instance of Explorer.exe. By making this verb the default verb, a double-click will also open a rooted view of the file. You can either define a verb for all members of the file class by modifying the registry, or dynamically define verbs on a file-by-file basis by implementing a shortcut menu handler.

The following example illustrates how to use the registry to provide a rooted view of the members of a file class by modifying the registry. The sample registry entry is a modification of one of the examples in Extending Shortcut Menus. The registry entries define files with an .myp file name extension as a file class, and use the browse verb to launch a rooted view of members of that class.

HKEY_CLASSES_ROOT
  .myp=MyProgram.1
  ...
  MyProgram.1=MyProgram Application
    Shell=browse
      browse
        command=%SYSTEMROOT%\explorer.exe /e,/root,{Extension CLSID}, "%1"

You can use the same verb to programmatically launch a rooted view of a member of the file class by calling ShellExecute.


--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------
"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C580E2A...@hotmail.com...
> Hi David,
> Thanks again for trying to help but I have already been there and done that.   I have already created a desktop namespace extension with a hardcoded .dpl
> filename.   It handles the view of this file just the way I want.
>
> The challenge that I am facing is how do I get the shell to allow me to dynamically create namespace folders for each .dpl file that it encounters.   I have
> yet to figure this out....
>
> Pat
>
> David Candy wrote:
>
> > Well it does. Have you seen the sample app regview that displays the registry as items in a namespace extensionn
> >
> > Search the MSDN for the source, I've attached a dll. run regsvr32 on it and you'll see it in action. Merge the reg file to move it from My Comp to desktop.
> > --
> > ---------------------------------------------------------------
> > David Candy
> >
www.mvps.org/serenitymacros
> > http://www.winsite.com/bin/Info?500000002364
> > ---------------------------------------------------------------
> > "Patrick J O'Neil" <
pato...@hotmail.com> wrote in message news:3C56BB39...@hotmail.com...
> > > Hi David,
> > >
> > > Thanks for the suggestion but it does not apply to my problems.
> > >
> > > I have written a namespace extension.   I can associate the namespace extension with my extension
> > > (".dpl") but it does not treat the file as a "compressed folder".
> > >
> > > The only ways that are documented to create namespaces do not apply if you want Windows Explorer to
> > > treat all files with a file extension of dpl as folders with specialized contents.
> > >
> > > Any other ideas?
...
> >   ------------------------------------------------------------------------
> >                   Name: RegView.zip
> >    RegView.zip    Type: Zip Compressed Data (application/x-zip-compressed)
> >               Encoding: base64
>

Patrick J O'Neil

unread,
Jan 1, 2002, 9:22:05 AM1/1/02
to
Hi David,

Well,  I have finally made some progress but am still not there.   It's very strange that the documentation does not match the implementation.    I have tried every combination possible.  None of the commands work if they are set up in the system registry, regardless of how I try.

I have found only one command that works from the Start-->Run and that is:
explorer /e,/root, {F778AFE0-2289-11d0-8AEC-00A0C90C9246}, D:\My Documents\Combined Library.dpl

This opens a new Explorer window (not exactly what I want but a start) with "Combined Library.dpl" as the folder name and my namespace extension as the viewer.   However, for the life of me,  I cannot get it to treat the "Combined Library.dpl" as a folder with subfolders (e.g., a plus sign to the left).   I need that to be able to navigate to the different subfolders in the library.

Any ideas?
Pat

David Candy

unread,
Jan 3, 2002, 5:32:39 PM1/3/02
to
Have you seen cabview sample (it also comes with 95 powertoys and NT4 powertoys too I think) that is part of 98/2000/ME/XP.
 
+ signs are put there with the shellfolder flags in it's registry entries. Cabview
Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\CLSID\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}\ShellFolder]
"Attributes"=dword:680001a0
The attributes define the behaviour of your namespace extension.
 
 
This is the command line cabview uses
%SystemRoot%\Explorer.exe /idlist,%I,%L
Though it uses DDE as well.
 

/IDLIST

This is an additional parameter that means a Windows internal structure is being passed. eg:

Explorer.exe /e,/idlist,%I

The %I is a replacable parameter representing an IDLIST.

%L is a long file name
 
 
The extension is set to the name space
[HKEY_CLASSES_ROOT\.cab]
@="CLSID\\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}"
"InfoTip"="Contains compressed files"

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------
"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C31C60D...@hotmail.com...

Patrick J O'Neil

unread,
Jan 3, 2002, 8:19:44 PM1/3/02
to
Hi Dave,

I looked briefly at the cabview sample and will probably need to go back to it since everything that I try seems to fail.

I tried setting up my registry just as you suggested but I get an error message when I "Explore" the file.  The error message states that Explorer cannot find the file!!!  The name is right but it cannot find it.

There is obviously something that I am missing but I don't have a clue what it is....

Is there a complete list of Explorer slash commands.  I have seen so far /e, /root and /idlist?

Frustrated....
Pat

David Candy wrote:

 Have you seen cabview sample (it also comes with 95 powertoys and NT4 powertoys too I think) that is part of 98/2000/ME/XP. + signs are put there with the shellfolder flags in it's registry entries. CabviewWindows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}\ShellFolder]
"Attributes"=dword:680001a0The attributes define the behaviour of your namespace extension.  This is the command line cabview uses%SystemRoot%\Explorer.exe /idlist,%I,%LThough it uses DDE as well. 

/IDLIST

This is an additional parameter that means a Windows internal structure is being passed. eg:
Explorer.exe /e,/idlist,%I

The %I is a replacable parameter representing an IDLIST.%L is a long file name  The extension is set to the name space[HKEY_CLASSES_ROOT\.cab]

@="CLSID\\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}"
"InfoTip"="Contains compressed files" 
--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------

"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C31C60D...@hotmail.com...Hi David,

David Candy

unread,
Jan 3, 2002, 9:09:30 PM1/3/02
to
That is the complete list of explorer commands. You would have to set up the DDE so explorer and your NSE can browse through your file. I just get a sense, and I can't put my finger on it, that there's a misunderstanding somewhere between how you think it works and how it works.
 
This is not the best group for this question. I don't program in C and I've never actually written one. Try news://msnews.microsoft.com/microsoft.public.platformsdk.shell
Tell them what've you've done, what interfaces you've used, when you've used what function calls/methods in response to what events.
 
Post your full registry entries as well (post them here and I'll look at them).
 
But you can't explore into your folder unless it's rooted.

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------
"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C350330...@hotmail.com...

Patrick J O'Neil

unread,
Jan 4, 2002, 7:05:58 PM1/4/02
to
Hi David,

Here are my registry entries
HKCR/.dpl    default value is Digital PhotoLibrary
HKCR/DigitalPhotoLibrary  default value is "Digital Photo Library"
HKCR/DigitalPhotoLibrary/CLSID default value is {F778AFE0-2289-11d0-8AEC-00A0C90C9246}
HKCR/DigitalPhotoLibrary/Shell/Execute/Command default value is ""%SYSTEMROOT%\explorer.exe /e, /root"
HKCR/DigitalPhotoLibrary/Shell/Execute1/Command default value is ""%SystemRoot%\Explorer.exe /idlist,%I,%L"
HKCR/DigitalPhotoLibrary/Shell/Execute1/Command default value is ""%SystemRoot%\Explorer.exe /idlist,%I,%L"
HKCR/DigitalPhotoLibrary/Shell/Execute2/Command default value is "%SYSTEMROOT%explorer /e,::{F778AFE0-2289-11d0-8AEC-00A0C90C9246},"%1""
All of these give me an error...

Lets go back to what I am trying to accomplish... I am trying to implement a namespace extension to explore database files.   I want to trigger the creation of a "???.dpl" namespace folder ( with "+" sign to denote subfolder) every time Windows Explorer encounters a .dpl file in a folder.

Is this possible?
 

David Candy wrote:

 That is the complete list of explorer commands. You would have to set up the DDE so explorer and your NSE can browse through your file. I just get a sense, and I can't put my finger on it, that there's a misunderstanding somewhere between how you think it works and how it works. This is not the best group for this question. I don't program in C and I've never actually written one. Try news://msnews.microsoft.com/microsoft.public.platformsdk.shellTell them what've you've done, what interfaces you've used, when you've used what function calls/methods in response to what events. Post your full registry entries as well (post them here and I'll look at them). But you can't explore into your folder unless it's rooted.

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------

"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C350330...@hotmail.com...Hi Dave,

David Candy

unread,
Jan 4, 2002, 7:34:08 PM1/4/02
to
You can't browse into a file, only folders - this is microsoft's rule. So an explorer view must be rooted. You appear to be using 2000/XP registry entries (%systemroot% which memory tells me doesn't work on 98 though it might on ME).
 
This is ok
 
+MyDatabase
    +A Table or something
    +A query or something
This is not
 
+ My Computer
    + C Drive
        +My Documents
            +My Database
                +A Table or something
                +A query or something
 
The plus signs are put there by either you or by the shellfolder key in the namespace registration (which plus signs?). (Which are the same constants as in the following topic). Which plus signs are you referring to. You said your file opened ok but you couldn't browse to sub folders in it. You need DDE entries for that which you don't seem to have. Look at the DDE entries for compressed folders and cabfile.
 
But you can't have it in the treeview if it's a file as it is unless the dbl thingy is the top level folder (that is rooted like zips are). You'll notice that zips are only in explorer view if opened first.
 
 
 

IShellFolder::GetAttributesOf


Retrieves the attributes of one or more file objects or subfolders.

HRESULT GetAttributesOf(
    UINT cidl,
    LPCITEMIDLIST *apidl,
    SFGAOF *rgfInOut
   );

Parameters

cidl
[in] Number of file objects from which to retrieve attributes.
apidl
[in] Address of an array of pointers to ITEMIDLIST structures, each of which uniquely identifies a file object relative to the parent folder. Each ITEMIDLIST structure must contain exactly one SHITEMID structure followed by a terminating zero.
rgfInOut
[in/out] Address of a single ULONG value that, on entry, contains the attributes that the caller is requesting. On exit, this value contains the requested attributes that are common to all of the specified objects. Note that this is the address of a single ULONG value, not an array of ULONG values. The lists below describe the possible flags for this parameter.

A file object's capability flags may be zero or a combination of the following values:

Flag Value Description
SFGAO_CANCOPY 0x00000001 The specified file objects or folders can be copied (same value as the DROPEFFECT_COPY flag).
SFGAO_CANDELETE 0x00000020 The specified file objects or folders can be deleted.
SFGAO_CANLINK 0x00000004 Shortcuts can be created for the specified file objects or folders. This flag has the same value as DROPEFFECT_LINK. The normal use of this flag is to add a "Create Shortcut" item to the shortcut menu that is displayed during drag-and-drop operations. However, SFGAO_CANLINK also adds a "Create Shortcut" item to the Windows Explorer's File menu, and to normal shortcut menus. If this item is selected, your application's IContextMenu::InvokeCommand will be invoked with the lpVerb member of the CMINVOKECOMMANDINFO structure set to "link". Your application is responsible for creating the link.
SFGAO_CANMONIKER 0x00400000 It is possible to create monikers for the specified file objects or folders.
SFGAO_CANMOVE 0x00000002 The specified file objects or folders can be moved (same value as the DROPEFFECT_MOVE flag).
SFGAO_CANRENAME 0x00000010 The specified file objects or folders can be renamed. Note that this flag is essentially a suggestion. It does not guarantee that a namespace client will rename the file or folder object.
SFGAO_CAPABILITYMASK 0x00000177 This flag is a mask for the capability flags.
SFGAO_DROPTARGET 0x00000100 The specified file objects or folders are drop targets.
SFGAO_HASPROPSHEET 0x00000040 The specified file objects or folders have property sheets.

A file object's display attributes may be zero or a combination of the following values:

Flag Value Description
SFGAO_DISPLAYATTRMASK 0x000F0000 This flag is a mask for the display attributes.
SFGAO_GHOSTED 0x00080000 The specified file objects or folders should be displayed using a ghosted icon.
SFGAO_LINK 0x00010000 The specified file objects are shortcuts.
SFGAO_READONLY 0x00040000 The specified file objects or folders are read-only.
SFGAO_SHARE 0x00020000 The specified folders are shared.

A file object's contents flags may be zero or a combination of the following values:

Flag Value Description
SFGAO_CONTENTSMASK 0x80000000 This flag is a mask for the contents attributes.
SFGAO_HASSUBFOLDER 0x80000000 The specified folders may have subfolders, and are, therefore expandable in the left pane of Windows® Explorer.

Note: The SFGAO_HASSUBFOLDER attribute is only advisory, and may be returned by Shell folder implementations even if they do not contain subfolders. Returning SFGAO_HASSUBFOLDER is recommended whenever a significant amount of time is required to determine whether or not any subfolders exist. For example, the Shell always returns SFGAO_HASSUBFOLDER when a folder is located on a network drive.

A file object's miscellaneous attributes may be zero or a combination of the following values:

Flag Value Description
SFGAO_BROWSABLE 0x08000000 The specified items can be browsed in place.
SFGAO_COMPRESSED 0x04000000 The specified items are compressed.
SFGAO_FILESYSTEM 0x40000000 The specified folders or file objects are part of the file system (that is, they are files, directories, or root directories).
SFGAO_FILESYSANCESTOR 0x10000000 The specified folders contain one or more file system folders.
SFGAO_FOLDER 0x20000000 The specified items are folders.
SFGAO_NEWCONTENT 0x00200000 The objects contain new content.
SFGAO_NONENUMERATED 0x00100000 The items are nonenumerated items.
SFGAO_REMOVABLE 0x02000000 The specified file objects or folders are on removable media.
SFGAO_VALIDATE 0x01000000 Validate cached information. The Shell will validate that the objects specified in apidl still exist and will not use cached information when retrieving the attributes. If one or more of the items specified in apidl no longer exist, this method will return an error code. If cidl is zero, the Shell will discard all cached information for the Shell folder. This is similar to doing a refresh of the folder.

Return Values

Returns NOERROR if successful, or an OLE-defined error value otherwise.

Remarks

You can optimize this operation by not returning unspecified flags.

See Also

IShellFolder

Requirements

  Version 4.00 and later of Shell32.dll

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98/Me: Requires Windows 95 or later.
  Header: Declared in Shlobj.h.

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------
"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C364366...@hotmail.com...

David Candy

unread,
Jan 5, 2002, 11:35:59 AM1/5/02
to
The posts are getting too big so I've snipped.

Patrick J O'Neil

unread,
Jan 6, 2002, 11:33:31 AM1/6/02
to
Hi David,

The web reference that you give is to a cabview extraction program and not the sample cabview shell extension.   I still cannot find the sample cabview shell anywhere other than the article with snippits of code in it.   Do you have a copy or know where to download from?

I don't understand your meaning of the following:  "It goes in shellfolder key not shellext key, see mydocs or mycomputer or recycled bin entries."

Thanks for the explanation of the DDE entries.   I think I understand what you are saying... that Explorer uses them and not any of my code....

Thanks again for putting up with me...   I really appreciate it....

Pat

David Candy wrote:

 Cabview the program is different to cabview the samplehttp://msdn.microsoft.com/msdn-files/026/000/017/readme_txt.asp?frame=true It goes in shellfolder key not shellext key, see mydocs or mycomputer or recycled bin entries. DDE is used to change folders without starting a new instance of explorer. EG when you click a word document word start up without a document open then explorer sends it a fileopen command and the filename so the existing word will open files

David Candy

unread,
Jan 7, 2002, 4:13:27 AM1/7/02
to
[HKEY_CLASSES_ROOT\CLSID\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}\ShellFolder]
"Attributes"=dword:680001a0
 
Not shellext but shellfolder. I don't have a copy as I'm not a C programmer so the source is useless to me.
 
From another article,
 Before starting with my first namespace extensions I tried to gather some information and samples. Unfortunately, I found only the aforementioned article by Dave Campbell and the CABVIEW sample that comes with Visual C++® 5.0. Some basic information is also available in the Visual C++ Books Online.
Looks like it's been pulled from 6.
 
And more
Notes
=====

This CabView sample replaced another CabView sample available in previous
versions of the Platform SDK. That sample allowed to user to view the contents
of a Cabinet file through Explorer by implementing a shell namespace extension.
For a sample namespace extension, see the SampView sample in
%MSSDK%\Samples\WinUI\Shell\SampView, where MSSDK is the installation path of
the Platform SDK.
You really should ask in that other group I mentioned earlier in thread. Filled with confused programmers asking namespace questions
 
Having typed all this shit I probably do have it in an old platform SDK. But if i type somebody must read, so you'll have to read it. Checking 1998. Sucess.
 
Email me and I'll return a 525K cab file with all ui samples from 1988.

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------
"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C387C5B...@hotmail.com...

David Candy

unread,
Jan 9, 2002, 12:24:54 AM1/9/02
to
Do you want the sample.

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------

"David Candy" <dav...@sia.net.au> wrote in message news:OnONYu1lBHA.2252@tkmsftngp04...

Patrick J O'Neil

unread,
Jan 9, 2002, 3:50:48 AM1/9/02
to
David, I got a copy of the source code for CabView. Thnks

David Candy

unread,
Jan 9, 2002, 4:32:36 AM1/9/02
to
Can delete it now.

--
---------------------------------------------------------------
David Candy
www.mvps.org/serenitymacros
http://www.winsite.com/bin/Info?500000002364
---------------------------------------------------------------

"Patrick J O'Neil" <pato...@hotmail.com> wrote in message news:3C3C0468...@hotmail.com...

0 new messages