]> granicus.if.org Git - vim/commitdiff
patch 8.1.0906: using clumsy way to get console window handle v8.1.0906
authorBram Moolenaar <Bram@vim.org>
Tue, 12 Feb 2019 22:12:37 +0000 (23:12 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 12 Feb 2019 22:12:37 +0000 (23:12 +0100)
Problem:    Using clumsy way to get console window handle.
Solution:   Use GetConsoleWindow(). (Ken Takata, closes #3940)

src/os_mswin.c
src/version.c

index 8d46e53cf1ebc72b3aecfc2ada34f4b02534a042..8dafaa35b1b78d60c3c3586d7065f44a24cc5017 100644 (file)
@@ -1043,11 +1043,6 @@ extern HWND g_hWnd;      /* This is in os_win32.c. */
     static void
 GetConsoleHwnd(void)
 {
-# define MY_BUFSIZE 1024 // Buffer size for console window titles.
-
-    char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated WindowTitle.
-    char pszOldWindowTitle[MY_BUFSIZE]; // Contains original WindowTitle.
-
     /* Skip if it's already set. */
     if (s_hwnd != 0)
        return;
@@ -1061,17 +1056,7 @@ GetConsoleHwnd(void)
     }
 # endif
 
-    GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
-
-    wsprintf(pszNewWindowTitle, "%s/%d/%d",
-           pszOldWindowTitle,
-           GetTickCount(),
-           GetCurrentProcessId());
-    SetConsoleTitle(pszNewWindowTitle);
-    Sleep(40);
-    s_hwnd = FindWindow(NULL, pszNewWindowTitle);
-
-    SetConsoleTitle(pszOldWindowTitle);
+    s_hwnd = GetConsoleWindow();
 }
 
 /*
index f28d69dc66e5015ef05c32a65adec20d4526fd49..3a71b93929fbfdd7fce28fac6a9ca47cd7ae3dc0 100644 (file)
@@ -783,6 +783,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    906,
 /**/
     905,
 /**/