diff --git a/PluginDefinition.cpp b/PluginDefinition.cpp old mode 100644 new mode 100755 index 836ad14..1bba40c --- a/PluginDefinition.cpp +++ b/PluginDefinition.cpp @@ -22,6 +22,7 @@ #include "AboutDlg.h" #include #include +#include using namespace std; #include @@ -33,6 +34,7 @@ FuncItem funcItem[nbFunc]; // // The data of Notepad++ that you can use in your plugin commands // +map pi_map; void pluginInit(HANDLE hModule) @@ -160,7 +162,17 @@ bool launchPython(std::wstring &command, std::wstring &path) memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); - return CreateProcess( + bool ok = false; + std::wstring filename = getCurrentFile(ok); + if (ok) { + map::iterator it = pi_map.find(filename); + if (it != pi_map.end()) { + TerminateProcess(it->second.hProcess, 1); + pi_map.erase(it); + } + } + + bool result = CreateProcess( NULL, const_cast(command.c_str()), NULL, @@ -171,6 +183,11 @@ bool launchPython(std::wstring &command, std::wstring &path) path.c_str(), &si, &pi) != 0; + + if (result) + pi_map[filename] = pi; + + return result; } void run(bool isW, bool isI) { diff --git a/Unicode Debug/PyNPP.dll b/Unicode Debug/PyNPP.dll deleted file mode 100644 index 39bac18..0000000 Binary files a/Unicode Debug/PyNPP.dll and /dev/null differ diff --git a/Unicode Release/PyNPP.dll b/Unicode Release/PyNPP.dll new file mode 100755 index 0000000..3d3956b Binary files /dev/null and b/Unicode Release/PyNPP.dll differ diff --git a/versionRC.rc b/versionRC.rc new file mode 100755 index 0000000..77881e3 --- /dev/null +++ b/versionRC.rc @@ -0,0 +1,51 @@ +#include + +#define VER_FILEVERSION 1,1,0,0 +#define VER_FILEVERSION_STR "1.1\0" + +#define VER_PRODUCTVERSION 1,1,0,0 +#define VER_PRODUCTVERSION_STR "1.1\0" + +#ifndef DEBUG +#define VER_DEBUG 0 +#else +#define VER_DEBUG VS_FF_DEBUG +#endif + +VS_VERSION_INFO VERSIONINFO +FILEVERSION VER_FILEVERSION +PRODUCTVERSION VER_PRODUCTVERSION +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0x17L +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "Abd Allah Diab\0" + VALUE "FileDescription", "PyNPP Notepad++ Plugin\0" + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "InternalName", "PyNPP\0" + VALUE "LegalCopyright", "GPLv3\0" + VALUE "OriginalFilename", "PyNPP.dll\0" + VALUE "ProductName", "PyNPP\0" + VALUE "ProductVersion", VER_PRODUCTVERSION_STR + END + END + + BLOCK "VarFileInfo" + BEGIN + /* The following line should only be modified for localized versions. */ + /* It consists of any number of WORD,WORD pairs, with each pair */ + /* describing a language,codepage combination supported by the file. */ + /* */ + /* For example, a file might have values "0x409,1252" indicating that it */ + /* supports English language (0x409) in the Windows ANSI codepage (1252). */ + + VALUE "Translation", 0x409, 1252 + + END +END \ No newline at end of file