Edit with Notepad++ not working

2013-12-13
2013-12-19
  • lockedscope

    lockedscope - 2013-12-13

    I was using 5.0.3 version of Notepad++ and i decided to install 6.5.2 version. After installing 6.5.2, "Edit with Notepad++" context menu did not work, it does not raise any errors, seems unresponsive. I uninstalled and re-installed Notepad++. Also applied fixes(although they are not related to my case) recommended for ShellExecute error but they did not help.
    I also enabled/disabled RunAsAdmin option for the Notepad++.exe and its shortcut but that does not help also.

    I am using Window Vista Home Premium.

     
    Last edit: lockedscope 2013-12-13
  • cchris

    cchris - 2013-12-15

    Does the Notepad++ install folder have a NppShell_05.dll file?
    If so, open command prompt and enter
    regxvr32 /u NppShell_05.dll
    If you get an error there, either you didn't have the dll or something is wrong with your system.
    Then
    regxvr32 /s /i NppShell_05.dll
    If it succeeds (it shoould), close Explorr and open it back, and you should be done.

    You didn't mention whether your OS is 64 bit, there could be specific issues there - and the dll should be a different one.

    CChris

     
  • Dave Brotherstone

    Note that "Edit with Notepad++" won't work if N++ is running as admin.

    Dave.

     
  • Don HO

    Don HO - 2013-12-16

    Note that "Edit with Notepad++" won't work if N++ is running as admin.

    "Edit with Notepad++" does work while N++ is running as admin thanks to the following code in winmain.cpp:
    MESSAGEFILTERFUNCEX func = (MESSAGEFILTERFUNCEX)::GetProcAddress( hDll, "ChangeWindowMessageFilterEx" );
    if (func) {
    func(notepad_plus_plus.getHSelf(), WM_COPYDATA, MSGFLT_ALLOW, NULL );
    }

    I tested under 3 platforms Windows 7 64 bits, Windows 8 64 bits and Windows 8 32 bits.
    It doesn't work only under Windows 8 32 bits. I suppose que ChangeWindowMessageFilterEx doesn't support for 32 bits otherwise there's a bug for this API.

    Don

     
    Last edit: Don HO 2013-12-16
  • Loreia2

    Loreia2 - 2013-12-16

    It doesn't work only under Windows 8 32 bits. I suppose que ChangeWindowMessageFilterEx doesn't support for 32 bits otherwise there's a bug for this API.

    Actually, explanations is much simpler. (This is one of this little things that I wanted to fix, but never found enough free time to actually do it, as all of my free time goes into UDL)

    In order to support both 32-bit and 64-bit aplications, Notepad++ should ship with two versions of NppShell_05.dll (32 and 64 bit) and installer (nppSetup.nsi) should register both DLLs.

    Current behavior is: if system is 64-bit, it will register only 64-bit extension.

    The problem is this: 64-bit Windows run 32-bit file mangers just fine, but NppShell_05.dll is registered only for 64-bit applications. Therefore, on 64-bit Windows users will see "Edit with Notepad++" context menu in native 64-bit Windows explorer, but will not see it in third party 32-bit file manager.

    I just downloaded XYplorer application to test this (no context menu after normal Notepad++ installation in XYplorer (32-bit application)). I also quickly compiled NppShell_05.dll in 32-bit mode, unregistered default 64-bit NppShell_05.dll, and registered my own 32-bit version. Now, the situation was reversed, no context menu in Windows explorer, but functional context menu in XYplorer.

    Finally, I registered both DLLs and context menu is present in both applications (XYplorer and Windows explorer).

    So, whoever feel like spending some time on this should:
    a) compile 32-bit version of NppShell.dll
    b) extend nppSetup.nsi to double register NppShell.dll (both 32 and 64 bit versions on 64 bit host system). On 32-bit Windows, it should register just one (32 bit) version.

    Ok, I am off to do some UDL work ... :-)
    BR,
    Loreia

     
    • Don HO

      Don HO - 2013-12-17

      Hi Loreia,

      Notepad++ installer does provide 2 version of NppShell_05.dll: NppShell.dll and NppShell64.dll
      Installer detects the target PC configuration then choose the right one to copy as NppShell_05.dll thx to the following code in nppSetup.nsi:
      Section "Context Menu Entry" explorerContextMenu
      SetOverwrite try
      SetOutPath "$INSTDIR\"
      ${If} ${RunningX64}
      File /oname=$INSTDIR\NppShell_05.dll "..\bin\NppShell64_05.dll"
      ${Else}
      File "..\bin\NppShell_05.dll"
      ${EndIf}
      Exec 'regsvr32 /s "$INSTDIR\NppShell_05.dll"'
      SectionEnd

      In the original post, the problem is not "missing Edit with Notepad++", but "Edit with Notepad++ not working"

       
      Last edit: Don HO 2013-12-17
  • Loreia2

    Loreia2 - 2013-12-19

    Hi Don,

    he probably has "Edit with Notepad++" context menu from old installation, and it is not functionally because new DLL was not registered correctly for some reason.
    My post was about another problem. Not even related to the part I quoted (I was hasty and misunderstood what you wrote).

    Problem with installer is this: It will install 32-bit version of NppShell.dll on 32-bit Windows and 64-bit version on 64-bit Windows.

    It should be extended to work like this:
    On 32-bit Windows:
    - install 32-bit version only

    On 64-bit Windows:
    - install both 32-bit and 64-bit versions

    The reason is simple: 64-bit Windows must support both 32-bit and 64-bit file managers.

    So, code should be something like:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Section "Context Menu Entry" explorerContextMenu
    SetOverwrite try
    SetOutPath "$INSTDIR\"
    ${If} ${RunningX64}

    copy BOTH file here

    File /oname=$INSTDIR\NppShell_05_32.dll "..\bin\NppShell32_05.dll"
    File /oname=$INSTDIR\NppShell_05_64.dll "..\bin\NppShell64_05.dll"
    ${Else}
    File "..\bin\NppShell_05.dll"
    ${EndIf}

    ${If} ${RunningX64}
    Exec 'regsvr32 /s "$INSTDIR\NppShell_05_64.dll"'
    ${EndIf}
    Exec 'regsvr32 /s "$INSTDIR\NppShell_05_32.dll"'

    SectionEnd
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    BR,
    Loreia