From: Paul Randall on
I want to add a context menu item to the registry that will allow me
to right click within the white space (background) of an open folder
window and choose to open a command prompt with the same path as the
open folder window. I've searched the newsgroups and found hundreds
of references to things like "modify the right-click menu of folder
item", but these always seem refer to the context menu for a folder
icon, not for the background of an open folder window. I'm hoping
someone will post code or a URL that explains how to do it.

Thanks,
-Paul Randall


From: Stefan Kanthak on
"Paul Randall" <paulr901(a)cableone.net> wrote:

> I want to add a context menu item to the registry that will allow me
> to right click within the white space (background) of an open folder
> window and choose to open a command prompt with the same path as the
> open folder window.

IFF the explorer would use the shell subkey for "Background" the
following would work.

--- .REG ---
REGEDIT4

[HKEY_CLASSES_ROOT\Directory\Background\Shell\Prompt]

@="<your menu entry>"

[HKEY_CLASSES_ROOT\Directory\Background\Shell\Prompt\Command]
@="cmd.exe /K PushD %1"

[HKEY_CLASSES_ROOT\Drive\Background\Shell\Prompt]

@="<your menu entry>"

[HKEY_CLASSES_ROOT\Drive\Background\Shell\Prompt\Command]
@="cmd.exe /K PushD %1"
--- EOF ---

But explorer doesn't evaluate the shell subkey there.

> I've searched the newsgroups and found hundreds
> of references to things like "modify the right-click menu of folder
> item", but these always seem refer to the context menu for a folder
> icon, not for the background of an open folder window. I'm hoping
> someone will post code or a URL that explains how to do it.

You'll have to write a shell extension and register that under

[HKEY_CLASSES_ROOT\Directory\Background\ShellEx\ContextMenuHandlers\<your shell extension>]
@="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" ; the CLSID of your shell extension handler


[HKEY_CLASSES_ROOT\Drive\Background\ShellEx\ContextMenuHandlers\<your shell extension>]
@="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" ; the CLSID of your shell extension handler


But leave

[HKEY_CLASSES_ROOT\Folder\Background\ShellEx\ContextMenuHandlers\<your shell extension>]

alone: "Folder" is the superset of "Directory", "Drives" and all the
virtual folders created by the various namespace handlers which
generally are not backed up by a filesystem object, so a "ChDir" or
"PushD" would fail.

Stefan

From: Paul Randall on

"Stefan Kanthak" <postmaster@[127.0.0.1]> wrote in message
news:uO6VbtzxIHA.1436(a)TK2MSFTNGP05.phx.gbl...
> "Paul Randall" <paulr901(a)cableone.net> wrote:
>
>> I want to add a context menu item to the registry that will allow
>> me
>> to right click within the white space (background) of an open
>> folder
>> window and choose to open a command prompt with the same path as
>> the
>> open folder window.
>
> IFF the explorer would use the shell subkey for "Background" the
> following would work.
>
> --- .REG ---
> REGEDIT4
>
> [HKEY_CLASSES_ROOT\Directory\Background\Shell\Prompt]
>
> @="<your menu entry>"
>
> [HKEY_CLASSES_ROOT\Directory\Background\Shell\Prompt\Command]
> @="cmd.exe /K PushD %1"
>
> [HKEY_CLASSES_ROOT\Drive\Background\Shell\Prompt]
>
> @="<your menu entry>"
>
> [HKEY_CLASSES_ROOT\Drive\Background\Shell\Prompt\Command]
> @="cmd.exe /K PushD %1"
> --- EOF ---
>
> But explorer doesn't evaluate the shell subkey there.
>
>> I've searched the newsgroups and found hundreds
>> of references to things like "modify the right-click menu of folder
>> item", but these always seem refer to the context menu for a folder
>> icon, not for the background of an open folder window. I'm hoping
>> someone will post code or a URL that explains how to do it.
>
> You'll have to write a shell extension and register that under
>
> [HKEY_CLASSES_ROOT\Directory\Background\ShellEx\ContextMenuHandlers\<your
> shell extension>]
> @="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" ; the CLSID of your shell
> extension handler
>
>
> [HKEY_CLASSES_ROOT\Drive\Background\ShellEx\ContextMenuHandlers\<your
> shell extension>]
> @="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" ; the CLSID of your shell
> extension handler
>
>
> But leave
>
> [HKEY_CLASSES_ROOT\Folder\Background\ShellEx\ContextMenuHandlers\<your
> shell extension>]
>
> alone: "Folder" is the superset of "Directory", "Drives" and all the
> virtual folders created by the various namespace handlers which
> generally are not backed up by a filesystem object, so a "ChDir" or
> "PushD" would fail.


Thank you, Stefan. I appreciate the detailed information.

I think that writing a shell extension is beyond my capability unless
it can be done as a VBScript Windows Script Component. After reading
http://msdn.microsoft.com/en-us/library/cc144067(VS.85).aspx, I'm
thinking a WSC would not work.

-Paul Randall


From: Mark Pryor on
On Thu, 05 Jun 2008 08:00:09 -0600, Paul Randall wrote:

> I want to add a context menu item to the registry that will allow me
> to right click within the white space (background) of an open folder
> window and choose to open a command prompt with the same path as the
> open folder window. I've searched the newsgroups and found hundreds
> of references to things like "modify the right-click menu of folder
> item", but these always seem refer to the context menu for a folder
> icon, not for the background of an open folder window. I'm hoping
> someone will post code or a URL that explains how to do it.
>

Winxp Power Toys has it
http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx
http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe

Mark from tlviewer.org
From: mayayana on
> I suppose one solution would be to attach the 'Open Command Window
> Here' item to the context menus of everything that can be displayed in
> a folder window, but I don't know what the list of 'everything'
> includes, or the registry keys that would have to be modified to
> include all the possible things. Being able to right click in the
> white space of the background of an open explorer window and get a
> 'Open Command Window Here' context menu item would solve the whole
> problem even for empty folders, and not clutter the context menu lists
> for all the things that can be displayed in a folder window.
>

Maybe you could track down the key under
HKCR\.zip and add it to HKCR\*

In general,
an item can be added to any file extension menu
(and folders), by adding the necessary settings
under
HKCR\.ext\shell
OR
HKCR\classname\shell (where classsname is the file type.)

That's if the job can be done with just Registry
settings. (Ex.: Open with Notepad)

Context menu handlers are often used by
programs like ZIP programs and AV, in order to
add an item under the first menu divider on
the context menu. Those are created in the
Registry under
HKCR\.ext\shellex
OR
HKCR\classname\shell

They run a component when the menu item is
clicked.

If you don't find what you need under HKCR\.zip
look under the file type key (classname), like HKCR\zipfile.
The name of that key is the default value under
HKCR\.zip

Clicking in the folder window itself is really a
click on the system ListView window that's used
to display folder content. You'd have to hook that
somehow to get notification of the click. I'm not
sure that can even be done in a shell extension.
The ListView can be accessed via Windows messages
as a normal ListView, since the ListView's handle
is available, but it's running in a separate process,
So I imagine a system-wide hook would be needed
to catch the event messages like click or mouse-up.

The old folder.htt file has an embedded FileList
object that was actually a wrapper control
(a ShellFolderView) around the ListView. But even
that only provided a subset of functions for use
by Explorer, like the SelectionChanged event.

I wrote an Explorer Bar recently that might be
usable if you can script the operation. It's probably
not what you really want, but it does return the
customizing abilities of folder.htt to WinXP folder
windows. I wrote it with the thought that I might
have to use Windows Xtra Problems one of these
days and one of the biggest problems, from my
personal point of view, is that I'd have to give up my
numerous Win9x folder window customizations
(provided via folder.htt) for a "common tasks bar" that's
all but useless.

So I wrote an Explorer Bar that provides basic file
info. - thumbnails, file size, etc. But it also has "tabs".
The second tab is for JPG info. The 3rd tab show
an ADS file view of the folder. The 4th tab is a custom
webpage, which can be coded to do whatever you
want, thereby getting back all the options that Win9x/2000
for adding functionality in the HTML of a folder view. I use
it to bring my custom Win98 functions into WinXP folder
windows. It's all self- explanatory to someone familiar with
scripting.

www.jsware.net/jsware/jsfv.php3