Mercurial > public > mercurial-scm > hg
diff mercurial/win32.py @ 10240:3af4b39afe2a
cmdutil: hide child window created by win32 spawndetached()
Hiding the child process window is not strictly necessary but it avoids opening
an empty shell window when running hg serve as well as a task in the task bar.
The window is hidden after the process is already started causing a single
flicker.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 10 Jan 2010 18:13:34 +0100 |
parents | 3b94120864fc |
children | d6512b3e9ac0 |
line wrap: on
line diff
--- a/mercurial/win32.py Wed Jan 06 21:11:58 2010 +0100 +++ b/mercurial/win32.py Sun Jan 10 18:13:34 2010 +0100 @@ -16,7 +16,7 @@ import win32api import errno, os, sys, pywintypes, win32con, win32file, win32process -import winerror +import winerror, win32gui import osutil, encoding from win32com.shell import shell, shellcon @@ -172,3 +172,12 @@ win32process.ExitProcess(1) win32api.SetConsoleCtrlHandler(handler) +def hidewindow(): + def callback(*args, **kwargs): + hwnd, pid = args + wpid = win32process.GetWindowThreadProcessId(hwnd)[1] + if pid == wpid: + win32gui.ShowWindow(hwnd, win32con.SW_HIDE) + + pid = win32process.GetCurrentProcessId() + win32gui.EnumWindows(callback, pid)