Notepad++ 8.5.7 and "ExplorerCommandHandler" used to register the Context Menu

MVP

A company complained to me about Notepad++ version 8.5.7 and packaging it into MSIX.  It seems that the vendor changed how the native install registers their context menu.  Rather than registering under a ShellEx key, it uses a Shell key and a registry value named "ExplorerCommandHandler" that points to the COM InprocServer handler.

 

I have never seen this done before and documentation on it is hard to find, but the native install works flawlessly.  Meanwhile the MMPT ignores it because it is a shell verb without a command subkey.  This case should probably be handled by the MMPT.

 

For those reading this, TMEditX 3.5 also does not detect this situation, but it is something I'll put on the list for later this fall.

8 Replies
I just came across this problem with appv 5.1. Updated the notepad version and the context menu is gone.

@TomPaul678 

Here also context menu issues with App-V 5.1.

 

Notepad++ 7.8.5 works fine

Notepad_ok.png

 

Notepad++ 8.5.8 doesn't work:

Notepad_not_ok.png

Notepad_error.png

 

Does someone know if there is a way to resolve it?

When repackaging for App-V, the only solution right now is as follows:
After installing/configuring the app, use the registry to modify the SHELL file association under "Classes\*" (there might be a ProgID involved, so if so look there -- I am going from memory here!)

Under the shell entry you'll find a value name of "ExplorerCommandHandler". You can remove everything under the "Shell" key, and then under that add a traditional Shell Integration (since the menu provided by the shell extension is the same every time), which is a key "Open" containing a key "Command" with a default value of the path to the Notepad++ exe file with "%1" as an argument.

See https://www.tmurgent.com/TmBlog/?p=3643 for more explanation.

@TIMOTHY_MANGAN 

Hi Tim

Thanks and sorry for the late reply.

 

The "old" context menu does work but the icon is missing.

Roger_Wernli_0-1700461618753.png

On the sequenzer the icon is shown and the parameter has has been added to the registry.

Roger_Wernli_5-1700462093818.png

Roger_Wernli_1-1700461701993.png

 

On a test client if i look outside of the Notepad++ virtual environment the icon parameter has not been published.

Roger_Wernli_2-1700461800094.png

If i look inside of the Notepad++ virtual environment the icon parameter is available but the path has not been resolved.

Roger_Wernli_3-1700461900192.png

 

I think the path should look like in the command key.

Roger_Wernli_4-1700461942098.png

 

Any idea why this is happening?

 

kind regards

 

 

@Roger_Wernli 

 

The approach to fix the problem by turning the shell extension into a traditional shell entry is something done in the native registry while in monitoring mode, so paths should look "normal".

 

But I did take a look this morning at the solutions that I added for this issues in my software.  The fixes are based on supporting the ignored registration as shell extensions by manipulating the AppXManifest file.  This support was added for MSIX in TMEditX 6.5, and has been coded in an unlreleased version of TMEdit for App-V at this time (it will be in v 3.7 of TMEdit when released).

 

FOR MSIX:

For MSIX Packaing, the solution for the problem that I added focuses on supporting the skipped shell extension context menu handler. This, of course, only works on Windows 11.

 

Rather than turn the ignored shell extension into a Shell key, I modified the AppXManifest to support the shell extension.  The adjusted AppXManifest file is attached in the image.  It is the desktop4:Extension element near the bottom.  Both desktop4 and desktop5 schemas needed to be added at the top of the file as well.  Again, this is a solution for MSIX on Windows 11 as the extensions don't work on Windows 10.

TIMOTHYMANGAN_0-1700584095743.png

 

@TIMOTHY_MANGAN 

With the traditional shell entry the icon still doesn't appear in the context menu when published with App-v. 

So finally I solved it by disabling the context menu entry option during installation of the new Notepad++ version. Afterwards I copied the NppShell_06.dll from a previous version into the program directory of the new version and also used the shellex and CLSID entry of the previous version. 

The "Edit with Notepad++" command and the icon appears now in the context menu when published with App-V.

 

Not really a nice solution I know, but it works so far.

 

kind regards

@TIMOTHY_MANGAN 

Notepad++ 8.6
Also added to AppxManifest.xml:
xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
IgnorableNamespaces=com

Testet om Win10 22H2 (19045.3693) --> OK

PeerAtle_0-1701267837410.png

 

Hello Roger, @TIMOTHY_MANGAN 
This does the trick... - I tested it due to an update to Version 8.6.1

 

The Registry Class has to be isolated in the AppV-package 

 

In the AppxManifest.xml assure to not have that

 

		<appv:Extension Category="AppV.COM">
			<appv:COM>
				<appv:x64>
					<appv:Class>
						<appv:ClassId>{B298D29A-A6ED-11DE-BA8C-A68E55D89593}</appv:ClassId>
						<appv:Name>notepad++</appv:Name>
						<appv:InprocServer>
							<appv:Library>[{ProgramFilesX64}]\Notepad++\contextMenu\NppShell.dll</appv:Library>
							<appv:ThreadingModel>Apartment</appv:ThreadingModel>
						</appv:InprocServer>
					</appv:Class>
				</appv:x64>
			</appv:COM>
		</appv:Extension>

 

 

Then you register the component by deployment (machine) script

 

$myPackAppVPackageDir - this is a variable inside my deployment Script that resolves to its current location


regsvr32 /s "[$myPackAppVPackageDir]\Root\VFS\ProgramFilesX64\Notepad++\contextMenu\NppShell.dll"

and
for uninstall:
regsvr32 /u /s "[$myPackAppVPackageDir]\Root\VFS\ProgramFilesX64\Notepad++\contextMenu\NppShell.dll"

 

Kind Regards

daniel