python - stealth window
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Nov 9 22:21:10 EST 2007
En Thu, 08 Nov 2007 03:23:27 -0300, Adam <adamfromhungary at gmail.com>
escribió:
> I want create Windows console window in stealth with Python script. I
> tried
> search on internet but I do not find anything. I want something like this
> just it is in C++:
>
> HWND stealth; /*creating stealth (window is not visible)*/
> AllocConsole();
> stealth=FindWindowA("ConsoleWindowClass",NULL);
> ShowWindow(stealth,0);
>
> So I start my script and that is will be run in the background and I can
> trick with "hotkeys" in WINAMP. I do not worry for a new one window. :-)
> I
> hope you understand me because my english is not perfect.
Using the pywin32 packages from Mark Hammond, this is a direct translation
of the above:
<code>
import win32console, win32gui
win32console.AllocConsole()
stealth = win32gui.FindWindow("ConsoleWindowClass", None)
win32gui.ShowWindow(stealth, 0)
import time
time.sleep(5)
win32gui.ShowWindow(stealth, 1)
</code>
You must either run it using pythonw.exe, or remove the AllocConsole call
--
Gabriel Genellina
More information about the Python-list
mailing list