is it possible to control the windows of an external app
I want to take the control of the window
for exmple i开发者_Go百科 want to force to external app to start minimized
I mean when i enter this command
myapp Firefox
Firefox starts but minimized
firefox is not important I mean i want to do it with any gui application
If yes
can any body show me the way?
I am assuming you want to do this via Python since that's what the question is tagged as. The standard windows API allows you to provide start up info when launching a process in which you can specify whether you want the app to start minimized or not.
The only way I could find of doing this via Python was to use the subprocess module ( http://docs.python.org/library/subprocess.html ), and then provide the startupInfo parameter when launching the process. The documentation is very vague on what is expected for that parameter, but I was able to find one example here ( http://www.daniweb.com/forums/thread262417.html# ) that I've copied below.
import subprocess
info = subprocess.STARTUPINFO()
info.dwFlags = 1
info.wShowWindow = 0
subprocess.Popen("notepad.exe", startupinfo=info)
This does seem to be windows specific though.
HTH
I've not used it myself, but libwnck has commands to minimize a window, or to move it onto another workspace if you don't want to see it at all. It is probably Linux only, but you already have a Windows solution, so you could switch between the two.
Libwnck info: library.gnome.org
It also has Python bindings. Python-Wnck info: berlios.de
In Unix systems, windows are controlled by the Window manager. Therefore you have the following options
Use a window manager that can be externally controlled (e.g. via a socket)
Write your own window manager
Play with NETWM hints if you are writing the application yourself
I think however that gnome window managers (metacity, sawfish) are generally limited
精彩评论