diff src/GvimExt/gvimext.cpp @ 2972:bdc3335bd72e v7.3.258

updated for version 7.3.258 Problem: MS-Windows: The edit with existing vim context menu entries can be unwanted. Solution: Let a registry entry disable them. (Jerome Vuarand)
author Bram Moolenaar <bram@vim.org>
date Wed, 20 Jul 2011 17:27:25 +0200
parents b9bc9c5df131
children 37a54a85413e
line wrap: on
line diff
--- a/src/GvimExt/gvimext.cpp
+++ b/src/GvimExt/gvimext.cpp
@@ -586,8 +586,23 @@ STDMETHODIMP CShellExt::QueryContextMenu
 
     // Initialize m_cntOfHWnd to 0
     m_cntOfHWnd = 0;
-    // Retrieve all the vim instances
-    EnumWindows(EnumWindowsProc, (LPARAM)this);
+
+    HKEY keyhandle;
+    bool showExisting = true;
+
+    // Check whether "Edit with existing Vim" entries are disabled.
+    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
+				       KEY_READ, &keyhandle) == ERROR_SUCCESS)
+    {
+	if (RegQueryValueEx(keyhandle, "DisableEditWithExisting", 0, NULL,
+						 NULL, NULL) == ERROR_SUCCESS)
+	    showExisting = false;
+	RegCloseKey(keyhandle);
+    }
+
+    // Retrieve all the vim instances, unless disabled.
+    if (showExisting)
+	EnumWindows(EnumWindowsProc, (LPARAM)this);
 
     if (cbFiles > 1)
     {