Date: | August 2, 2007 / year-entry #282 |
Tags: | code |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20070802-00/?p=25743 |
Comments: | 23 |
Summary: | When you're installing your shell extension, you need to know which progid to hang it off of inside HKEY_CLASSES_ROOT. We'll start with the title question and then move on to other predefined (but perhaps not well-known) progids. "Folder" is the progid for any shell folder. It could be a virtual folder (like Control Panel) or... |
When you're installing your shell extension, you need to know which progid to hang it off of inside
|
Comments (23)
Comments are closed. |
Err, so what is the difference between a folder and a directory?
Tom – why would you want something that applies to "all file system objects" to appear on virtual folders like Control Panel?
Stupid person – You want to reread the first bullet. No really.
Here:"Folder" is the progid for any shell folder. It could be a virtual folder (like Control Panel) or a file system folder (like C:WINDOWS).
Hint, it makes a distinction between 2 things. virtual folders and file system folders. You still do not see the difference ?
Err, he just explained it. Here, let me show you a picture:
+——————————-+
| – FOLDER – |
| Control Panel |
| My Computer |
| My Network Places |
| and so forth |
| |
| +—————————+ |
| | – DIRECTORY – | |
| | C:Documents and Settings | |
| | C:Program Files | |
| | C:Windows | |
| | and so forth | |
| +—————————+ |
| |
+——————————-+
Understand?
Then, why microsoft make Control Panel looks like a directory?
Googol: Microsoft made the Control Panel look like a directory for the same reason that everything is a file in UNIX; it allows for uniform access.
I could be wrong, this is a guess on my part, but from the developer’s perspective all of our compiled and scripted languages don’t have to support a new API, they can use existing, tried and true, file system API’s to access the Control Panel, or any other thing that has a directory/file interface.
I think this discussion would be clearer if "file system" was hyphenated (i.e. "file-system") as it probably should be when used as an adjectival phrase.
However, when reading an article about programming, it pays to read closely, Tom & Stupid Person.
Anonymous: Not so much. Yes, you can do stupid IShellWhateverInterface tricks to access the Control Panel the same way you could C:WINDOWSSYSTEM32SOL.EXE, but none of the "classical" filesystem APIs (fopen, std::ifstream, CreateFile) let you walk into virtual folders like Control Panel and My Computer by default.
Unix does what it does because it makes the APIs identical for the programmer. Windows does what it does because it makes the GUIs identical for the user. There’s a difference.
Off into grammar nitpick land we go, sorry…
It shouldn’t be hypenated; it’s like "red house doors", not "high-flying airplanes." Yes, it’s ambiguous – is the house red or are the doors? Apparently, the language designers didn’t forsee the need for grouping operators. ;)
Is it correct to say that "folder" is a general term meaning an interface and container for a collection of objects whereas a "directory" is a physical container located on some storage medium? Thus all directories are folders but not all folders are directories. Some folders are interfaces generated in memory.
Mr Cranky: "However, when reading an article about programming, it pays to read closely, Tom & Stupid Person."
Almost got it. Remove the word "closely" from what you posted, and add a couple of other words, and it’s right:
"However, when reading an article about programming, it pays to actually read it, Tom & Stupid Person."
quartic — that’s essentially it. Folders belong to the Shell, Directories belong to the File System. The Shell treats Directories as a type of Folder, so you could say that Directories are Folders, but not all Folders are Directories.
In Vista things get a little more complicated, with virtualisation adding Virtual Directories to the mix, but that’s not what Mr. Chen’s talking about here.
quartic, regarding "red house doors," of course the language has constructs to remove that particular type of ambiguity, such as "doors on the red house" or "red doors on the house." :)
Sorry to be lazy and not look this up, but is AllFileSystemObjects really * and Directory and not * and Folder? It seems odd that it would limit itself to just system folders…
@Mr Cranky
For some reason my brain skipped over the first parenthetical, and when I read "file system" instead of "filesystem" or "file-system" the illusion was complete. Thank you for your civility in response.
Aah, I was wondering why my little right-click item (internal only, thank god) was turning up on system folders. Thank’ee, Raymond.
Since Mr. Chen actually went through the trouble to make a post about this, I am left with one inevitable conclusion:
I can’t believe he actually had to explain this. And I’m being very serious. I consider this one of the first things anyone making a shell extension must learn.
JamesNT
This information can be useful for normal users as well, not just shell extension writers. For example, here’s how you can make files without extension to open in notepad when double-clicked:
[HKEY_CLASSES_ROOT.shellopencommand]
@="notepad %L"
file-system directories is the punctuation that Bill Walsh, head copy editor at the Washington Post would insist on.
I would suggest there is not enough ambiguity to make it necessary; after all what on earth would a file system-directory (which is the only other alternative meaning) be.
haven’t we forgotten HKEY_CLASSES_ROOTDrive?
by that one. This is not “A complete list of all progids” just a selection of ones
that are not well known/easily confused. -Raymond]
Quartic – "Folder" is the word a Shell developer uses when they mean "An implementation of IShellFolder."
As a Mac and Windows user, I spent the last decade believing that "folder" and "directory" meant the same thing.
Now I’ve read that not only is one a subset of the other, but that which way round they go depends on the platform!
Mac: directory > folder
Windows: folder > directory
Why have we redefined these old terms to mean different things?