0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.0906: using clumsy way to get console window handle

Problem:    Using clumsy way to get console window handle.
Solution:   Use GetConsoleWindow(). (Ken Takata, closes #3940)
This commit is contained in:
Bram Moolenaar
2019-02-12 23:12:37 +01:00
parent 5567ad48b6
commit e1ed53f3f9
2 changed files with 3 additions and 16 deletions

View 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();
}
/*