SciTE Context Menu Extension

English, SciTE, SciTE Context Menu Add comments

Windows SciTE Context Menu (WSciTEcm) is a context menu handler that gives the ability, on Windows, to quickly open selected files with the source code editor SciTE in Windows Explorer.

Windows SciTE Context Menu in Action

Summary

Installation

For a friendly installation, I recommend to use the SciTE setup provided by Bruce Dodson. This Windows installer facilitates the deployment of a custom built version of SciTE and includes additional helpers such as the Context Menu Extension. Check the choice Register shell extension during the installation process.

For a manual installation, read the section Manual Installation below.

Manual Installation

  1. Copy wscitecm.dll in the SciTE directory. Refer to the section Unload the dll below if you have the error: Access is denied.
  2. In the SciTE directory installation, type the command: regsvr32 wscitecm.dll. This registers the DLL. A new entry Edit with SciTE is available in the menu displayed when you right-click on selected files in Windows Explorer.

Installation on Vista 64-bit

The package containing the binaries includes wscitecm.dll and wscitecm64.dll. Both work and were tested successfully on Vista 64-bit.

Dependencies

Version 1.3.0 was built with Visual Studio 2005. As such you may need to download and install the corresponding redistributable packages. Here are the Microsoft URLs for the redistributable packages:

Uninstallation

  • To uninstall a version prior to 1.2:
    • Double-click on the file wscitecm-remove.reg (included in the source and binary packages). This will clean-up the old registry keys. This script was provided by Bruce Dodson.
  • To uninstall a 1.2 version:
    • In the SciTE directory installation, type the command: regsvr32 /u wscitecm.dll.

Unload the DLL

If you try to delete or override the wscitecm.dll and you get the error Access is denied, it means that the library is already loaded. There are several options to workaround this issue:

  • Solution 1:
    • Close all the Windows Explorer instances open on your desktop and copy wsctecm.dll using the command line (Example: copy wscitecm.dll scite_directory).
  • Solution 2:
    • Reboot the computer and delete or override wscitecm.dll (Example: copy wscitecm.dll scite_directory) before starting Windows Explorer and before using the context menu.
  • Solution 3:
    • Open a command line window
    • Press Ctrl+Alt+Del to display the Windows Task Manager, display the Process tab and kill the explorer.exe process.
    • If the exlorer did not restart automatically, start it manually from the command line window: C:/>explorer.
    • Delete or override wscitecm.dll before using the context menu (Example: copy wscitecm.dll scite_directory).

Build

Until version 1.2.1, wscitecm was built with Visual C++ 6.0. Version 1.3.0 (32-bit and 64-bit) was built with Visual Studio 2005. A Makefile is provided with the sources: in the source directory, type nmake. Ensure that all the environment variables and paths are set correctly. To do so, use the command file VCVARS32.BAT available in the bin directory of Visual C++ installation.

File Releases

Release Notes

  • Version 1.3.0 (05/28/2008):
    • Paul Roukema implemented fixes to provide support for Windows Vista 64-bit
    • Built with Visual Studio 2005
    • Fixed warnings related to string functions
  • Version 1.2.1 (01/21/2003):
    • Released under the MIT License and packaged with the source code.
  • Version 1.2:
    • Registration and unregistration of the Shell Extension embedded in the DLL (wscitecm.dll).
    • SciTE icon displayed in the context menu.
  • Version 1.x:
    • Initial version.

Derived Work

To address personal needs, Angelo Mandato has been maintaining a forked version of WSciTEcm since 01/27/2004.

Legal

Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

15 Responses to “SciTE Context Menu Extension”

  1. Hajo Schlingensief Says:

    Hello André,

    thank you very mutch for the “SciTE Context Menu Extension”.
    Very great Code!
    I have modify your project to use it for a upcoming version
    of my program Drag’n'Crypt ULTRA (i will give you full credits for your work).
    I hope this is OK for you.

    With best Regards

    Hajo Schlingensief

  2. André Burgaud Says:

    Hajo,
    You are welcome! This code is available under the MIT license, so there should not be any problem. I’m glad it can be useful. Be aware that the current version is not working properly on Vista 64bit. This issue was reported to me a while ago by Don Ho, the lead developer of Notepad++. I started to work on a fix, but got distracted by other priorities and it is still pending… Let me know if you face the same issue. Thanks. - André -

  3. Abel Says:

    Andre,
    I saw your DLL through looking at SciTE. If I were to use your code for my own application for a context handler would you be able to show what parts of the code I need to modify?

    Abel

  4. André Burgaud Says:

    Hi Abel,
    Here is a brief summary of changes that could be done in order to fit a different application:

    • Create a unique identifier to replace the one at the beginning of wscitecm.h
    • Modify the different strings that are specific to SciTE including the registy keys in wscitecm.cpp
    • Modify the logic performed to handle the main executable (SciTE.exe) in wscitecm.cpp
    • Use a different icon

    - André -

  5. Paul Says:

    I find this extension to be indispensable, but have recently moved to a 64-bit vista environment. I’ve managed to get the extension to compile in 64-bit mode using the compilers included in the windows SDK. The makefile needs some tweaking and variable needs to be changed in type, other than that, smooth sailing.

  6. André Burgaud Says:

    Hi Paul,
    Would you mind to share your modifications? I never had a chance to address this issue and it would be nice if everyone using this feature on Vista 64-bit could also benefit from some “smooth sailing” ;-) - André -

  7. Kun Says:

    I think I just run regsvr32 as administrator under vista x64, and then the context menu works after reboot.

  8. Naveed Says:

    Here’s the x64 version if you need it: http://timebend.com/WSciteCMx64.dll

  9. André Burgaud Says:

    Paul Roukema shared the source code fixing issues on Vista 64-bit. Those fixes have been merged into wscitecm version 1.3.0 and available for download in this article. Thank you Paul for this contribution. - André -

  10. Jorr Says:

    Hey André,

    I have the most curios problem with the Scite context menu handler. I installed Scite via Dodson’s package (i believe it’s the same) and for a while had the menu item alright. However, after installing the Notepad++ application it seemed to replace Scite in the context menu. I had an extensive research on this last night and after trying to mimic every key I found about Notepad++ in the registry, I still got nothing. After seeing the source of your DLL, I believe the reason for this is that SOMEHOW Notepad++ uses the same GUID as CLSID in the registry. I always thought the chances for that are practically zero, but here we are. Either they were generated the same independantly which seems almost impossible or maybe the Notepad++ registration dll has used this one as a model, I don’t know.

    Anyway,

    i guess that by using my new GUID in the .h file and rebuilding, I’m gonna do the trick. But thought you should know and maybe contact the notepad++ team or change the guid yourself in your DLL, as I am pretty sure everyone having both programs will have this problem, bearing in mind that uninstalling Notepad++ won’t help unless I re-register wscitecm.dll.

    Of course there are other options to put yourself in the context menu via registry only (the way I discovered EditPad to use, create a key in HKEY_CURRENT_USER\Software\Classes\*\shell) so I could have used that to restore my menu item, but I just wanted to understand the problem.

  11. Jorr Says:

    After a reread, I might clear some confusion by pointing out that by “my new GUID” I mean the GUID I generated anew and put as CLSID in the registry trying to mimic Notepad++’s own that apparently replaced the original SciTE one.

    I had written this, but apparently deleted this particular sentence somehow before posting..

  12. André Burgaud Says:

    Hi Jorr,

    Thanks for your comments and for sharing your experience. Sorry that you encountered this problem. This is indeed a known issue that I recently brought to the attention of Don Ho, the lead developer of Notepad++. Notepad++ context menu is based on wscitecm source code, hence this issue. To limit impacts on SciTE users and prevent clashes with Notepad++, I will shortly produce a version of wscitecm with a new unique identifier. - André -

  13. Jorr Says:

    Thanks, Andre

    I’ll be waiting for your patch since apparently I lack some important know-how about DLL registering. I tried to rebuild your source, but I can’t register it due to missing dependancy. I suspect it is due to the lack of the vc2005 redist, but that doesnt explain why it worked the first time when i installed it (via the kit installer)

  14. Abel Says:

    Sorry to bother you again, but now that I have downloaded the latest version built with VS2005 what would i need to change to use it for my own app. I definitely dont want to compile and make it conflict with any existing DLLs.

    Abel

  15. André Burgaud Says:

    Hi Abel,

    To avoid any conflict, you need only to worry about generating a new unique identifier for your application.

    The GUID or UUID can be generated with tools such as Microsoft guidgen. You may also find online solutions like Universally Unique Identifiers (UUIDs).

    Libraries are also available for different platforms and languages. As an example, with .NET and IronPython it gives something like:


    >>>import System
    >>>System.Guid.NewGuid().ToString()
    '728ecfd2-aba8-415f-a8ed-0286fee2d70f'
    >>>

    In wscitecm source code, the GUID is declated at the beginning of wscitecm.h.

    - André -

Leave a Reply

Powered by WordPress. Original Theme by N.Design Studio. Header image by NASA
Posts RSS Comments RSS Log in