cannot get new menu to work

D

David McDivitt

I've read numerous things about adding items to the "new" right-click sub
menu in explorer. I have WinXP SP 2. I want to create new php files by right
clicking in the folder. I wrote a VB program that adds two items to the
right-click menu: Open in Browser, and Open with Notepad. If I choose either
of those, the VB program runs, computes the IIS virtual path and opens the
php file through the browser, or uses what's found at txt/shell/open/command
and opens the php file with that. If I can write a VB program to do that,
surely I should be able to make the "new" sub menu work like I want.

At hkey_classes_root I added .php\ShellNew and put the value name "NullFile"
with a blank string value. That did not work. Even after a reboot, my new
item would not appear in the "new" menu. The file class for .php is
"phpfile", so I added .php\phpfile\ShellNew, also with a "NullFile" value
name. Some instructions I found said to do it that way. That didn't work
either.

TweakUI for XP does not have the "new" tab. So I found TweakUI for Win98 and
used that. In TweakUI for 98, in the "new" tab, lo and behold it has "php"
listed. If I toggle "php" on and off while looking in the registry, it
changes the ShellNew key I added to ShellNew- and back again. If it shows up
in TweakUI for 98, why doesn't it work in the explorer "new" sub menu?
 
R

Ramesh, MS-MVP

David,

Is the .PHP file associated correctly? Although there is a file class present for .PHP, there need to be a shell\open\command branch with the application defined in (default) under the file class.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


I've read numerous things about adding items to the "new" right-click sub
menu in explorer. I have WinXP SP 2. I want to create new php files by right
clicking in the folder. I wrote a VB program that adds two items to the
right-click menu: Open in Browser, and Open with Notepad. If I choose either
of those, the VB program runs, computes the IIS virtual path and opens the
php file through the browser, or uses what's found at txt/shell/open/command
and opens the php file with that. If I can write a VB program to do that,
surely I should be able to make the "new" sub menu work like I want.

At hkey_classes_root I added .php\ShellNew and put the value name "NullFile"
with a blank string value. That did not work. Even after a reboot, my new
item would not appear in the "new" menu. The file class for .php is
"phpfile", so I added .php\phpfile\ShellNew, also with a "NullFile" value
name. Some instructions I found said to do it that way. That didn't work
either.

TweakUI for XP does not have the "new" tab. So I found TweakUI for Win98 and
used that. In TweakUI for 98, in the "new" tab, lo and behold it has "php"
listed. If I toggle "php" on and off while looking in the registry, it
changes the ShellNew key I added to ShellNew- and back again. If it shows up
in TweakUI for 98, why doesn't it work in the explorer "new" sub menu?
 
D

David McDivitt

From: "Ramesh said:
Date: Wed, 8 Aug 2007 11:00:18 +0530
Lines: 51
I've read numerous things about adding items to the "new" right-click sub
menu in explorer. I have WinXP SP 2. I want to create new php files by right
clicking in the folder. I wrote a VB program that adds two items to the
right-click menu: Open in Browser, and Open with Notepad. If I choose either
of those, the VB program runs, computes the IIS virtual path and opens the
php file through the browser, or uses what's found at txt/shell/open/command
and opens the php file with that. If I can write a VB program to do that,
surely I should be able to make the "new" sub menu work like I want.

At hkey_classes_root I added .php\ShellNew and put the value name "NullFile"
with a blank string value. That did not work. Even after a reboot, my new
item would not appear in the "new" menu. The file class for .php is
"phpfile", so I added .php\phpfile\ShellNew, also with a "NullFile" value
name. Some instructions I found said to do it that way. That didn't work
either.

TweakUI for XP does not have the "new" tab. So I found TweakUI for Win98 and
used that. In TweakUI for 98, in the "new" tab, lo and behold it has "php"
listed. If I toggle "php" on and off while looking in the registry, it
changes the ShellNew key I added to ShellNew- and back again. If it shows up
in TweakUI for 98, why doesn't it work in the explorer "new" sub menu?

David,

Is the .PHP file associated correctly? Although there is a file class present for .PHP, there need to be a shell\open\command branch with the application defined in (default) under the file class.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


I dumped out the two registry keys and pasted them here. From all I've read,
the "ShellNew" key as shown should make an item in the "new" sub menu.

[HKEY_CLASSES_ROOT\.php]
@="php_auto_file"

[HKEY_CLASSES_ROOT\.php\ShellNew]
@=""
"NullFile"=""

[HKEY_CLASSES_ROOT\php_auto_file]
@="browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell]
@="browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser]
@="Open in Browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\""

[HKEY_CLASSES_ROOT\php_auto_file\shell\http]
@="Edit HTTP path"

[HKEY_CLASSES_ROOT\php_auto_file\shell\http\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\" /set"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad]
@="Open with notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\" /notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\open]

[HKEY_CLASSES_ROOT\php_auto_file\shell\open\command]
@="\"C:\\php\\php-win.exe\" \"%1\""
 
R

Ramesh, MS-MVP

The same REG file adds a shellnew entry for PHP. But it's shown as "browser".

Make the alteration here.

[HKEY_CLASSES_ROOT\php_auto_file]
@="browser"

set it as
@="PHP File"

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


David McDivitt said:
From: "Ramesh, MS-MVP" <[email protected]>
Date: Wed, 8 Aug 2007 11:00:18 +0530
Lines: 51
I've read numerous things about adding items to the "new" right-click sub
menu in explorer. I have WinXP SP 2. I want to create new php files by right
clicking in the folder. I wrote a VB program that adds two items to the
right-click menu: Open in Browser, and Open with Notepad. If I choose either
of those, the VB program runs, computes the IIS virtual path and opens the
php file through the browser, or uses what's found at txt/shell/open/command
and opens the php file with that. If I can write a VB program to do that,
surely I should be able to make the "new" sub menu work like I want.

At hkey_classes_root I added .php\ShellNew and put the value name "NullFile"
with a blank string value. That did not work. Even after a reboot, my new
item would not appear in the "new" menu. The file class for .php is
"phpfile", so I added .php\phpfile\ShellNew, also with a "NullFile" value
name. Some instructions I found said to do it that way. That didn't work
either.

TweakUI for XP does not have the "new" tab. So I found TweakUI for Win98 and
used that. In TweakUI for 98, in the "new" tab, lo and behold it has "php"
listed. If I toggle "php" on and off while looking in the registry, it
changes the ShellNew key I added to ShellNew- and back again. If it shows up
in TweakUI for 98, why doesn't it work in the explorer "new" sub menu?

David,

Is the .PHP file associated correctly? Although there is a file class present for .PHP, there need to be a shell\open\command branch with the application defined in (default) under the file class.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


I dumped out the two registry keys and pasted them here. From all I've read,
the "ShellNew" key as shown should make an item in the "new" sub menu.

[HKEY_CLASSES_ROOT\.php]
@="php_auto_file"

[HKEY_CLASSES_ROOT\.php\ShellNew]
@=""
"NullFile"=""

[HKEY_CLASSES_ROOT\php_auto_file]
@="browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell]
@="browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser]
@="Open in Browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP..exe\"
\"%1\""

[HKEY_CLASSES_ROOT\php_auto_file\shell\http]
@="Edit HTTP path"

[HKEY_CLASSES_ROOT\php_auto_file\shell\http\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP..exe\"
\"%1\" /set"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad]
@="Open with notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP..exe\"
\"%1\" /notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\open]

[HKEY_CLASSES_ROOT\php_auto_file\shell\open\command]
@="\"C:\\php\\php-win.exe\" \"%1\""
 
D

David McDivitt

From: "Ramesh said:
Date: Wed, 8 Aug 2007 19:41:58 +0530
Lines: 123

The same REG file adds a shellnew entry for PHP. But it's shown as "browser".

Make the alteration here.

[HKEY_CLASSES_ROOT\php_auto_file]
@="browser"

set it as
@="PHP File"

I found the problem. There must be an "open" verb in the file class,
otherwise no entry will appear in the "new" sub menu. There is no
documentation on this I can find. The following is what worked. If there is
no "open" verb, some other verb must be copied. Though I wanted "browse" to
be the default, there still needed to be an "open". I also changed from
NullFile to Command to give more control. At least one line is wrapped
below.

[HKEY_CLASSES_ROOT\.php]
@="php_auto_file"

[HKEY_CLASSES_ROOT\.php\ShellNew]
@=""
"Command"="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\" /new"

[HKEY_CLASSES_ROOT\php_auto_file]
@="PHP Web Document"

[HKEY_CLASSES_ROOT\php_auto_file\shell]
@="browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser]
@="Open in Browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\""

[HKEY_CLASSES_ROOT\php_auto_file\shell\http]
@="Edit HTTP path"

[HKEY_CLASSES_ROOT\php_auto_file\shell\http\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\" /set"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad]
@="Open with notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\" /notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\open]

[HKEY_CLASSES_ROOT\php_auto_file\shell\open\command]
@="\"C:\\php\\php-win.exe\" \"%1\""
 
R

Ramesh, MS-MVP

There must be an "open" verb in the file class

That's exactly what I said in my initial response.

<Q>
Although there is a file class present for .PHP, there need to be a shell\open\command branch with the application defined in (default) under the file class.
</Q>

And the Registry export you posted indicates that the "open" verb is already there.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


David McDivitt said:
From: "Ramesh, MS-MVP" <[email protected]>
Date: Wed, 8 Aug 2007 19:41:58 +0530
Lines: 123

The same REG file adds a shellnew entry for PHP. But it's shown as "browser".

Make the alteration here.

[HKEY_CLASSES_ROOT\php_auto_file]
@="browser"

set it as
@="PHP File"

I found the problem. There must be an "open" verb in the file class,
otherwise no entry will appear in the "new" sub menu. There is no
documentation on this I can find. The following is what worked. If there is
no "open" verb, some other verb must be copied. Though I wanted "browse" to
be the default, there still needed to be an "open". I also changed from
NullFile to Command to give more control. At least one line is wrapped
below.

[HKEY_CLASSES_ROOT\.php]
@="php_auto_file"

[HKEY_CLASSES_ROOT\.php\ShellNew]
@=""
"Command"="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP.exe\"
\"%1\" /new"

[HKEY_CLASSES_ROOT\php_auto_file]
@="PHP Web Document"

[HKEY_CLASSES_ROOT\php_auto_file\shell]
@="browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser]
@="Open in Browser"

[HKEY_CLASSES_ROOT\php_auto_file\shell\browser\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP..exe\"
\"%1\""

[HKEY_CLASSES_ROOT\php_auto_file\shell\http]
@="Edit HTTP path"

[HKEY_CLASSES_ROOT\php_auto_file\shell\http\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP..exe\"
\"%1\" /set"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad]
@="Open with notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\notepad\command]
@="\"C:\\David\\ASP\\VB\\Projects\\RunPHP\\RunPHP\\obj\\Release\\RunPHP..exe\"
\"%1\" /notepad"

[HKEY_CLASSES_ROOT\php_auto_file\shell\open]

[HKEY_CLASSES_ROOT\php_auto_file\shell\open\command]
@="\"C:\\php\\php-win.exe\" \"%1\""
 
D

David McDivitt

From: "Ramesh said:
Date: Thu, 9 Aug 2007 11:26:34 +0530
Lines: 93


That's exactly what I said in my initial response.

<Q>
Although there is a file class present for .PHP, there need to be a shell\open\command branch with the application defined in (default) under the file class.
</Q>

And the Registry export you posted indicates that the "open" verb is already there.


Yes, you did say that. Thanks for helping. I was going back and forth
between two different machines that had different file classes. But I'm glad
to know how it works now so I can automate it.
 
R

Ramesh, MS-MVP

No problem David.

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


David McDivitt said:
From: "Ramesh, MS-MVP" <[email protected]>
Date: Thu, 9 Aug 2007 11:26:34 +0530
Lines: 93


That's exactly what I said in my initial response.

<Q>
Although there is a file class present for .PHP, there need to be a shell\open\command branch with the application defined in (default) under the file class.
</Q>

And the Registry export you posted indicates that the "open" verb is already there.


Yes, you did say that. Thanks for helping. I was going back and forth
between two different machines that had different file classes. But I'm glad
to know how it works now so I can automate it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top