J'aimerais, à partir d'un programme python, lancer un executable windows, récupérer le handle sur sa fenetre principale et envoyer des messages pour simuler l'appui sur des touches.
Je pense que c'est possible avec pywin32. Je sais lancer un process. Je sais envoyer des messages à une fenetre (à l'aide de son handle). Mais comment récupérer le handle sur la fenetre principale ?
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Laurent Pointal
Bonjour,
J'aimerais, à partir d'un programme python, lancer un executable windows, récupérer le handle sur sa fenetre principale et envoyer des messages pour simuler l'appui sur des touches. Je pense que c'est possible avec pywin32. Je sais lancer un process. Je sais envoyer des messages à une fenetre (à l'aide de son handle). Mais comment récupérer le handle sur la fenetre principale ? Nicolas
Peut-être via WMI (en attribut de l'objet correspondant au process) ???
Sinon, en recherchant python + process + window + handle sur google, on tombe sur:
http://mail.python.org/pipermail/python-list/2003-March/153917.html ----------------------------------------------------------- Mark Hammond Tue, 18 Mar 2003 10:39:10 GMT
* Previous message: Window handle (hwnd) from process or thread info * Next message: 2 UK Jobs * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Constant wrote:
The Win32 CreateProcess(), including the win32process.CreateProcess(), function return the following info about the process that it just created:
Is it possible to get the window handle (HWND) of the window, that was created by this process, from these pieces of information?
Use win32api.EnumWindows() to enumerate all top-level windows, then call win32process.GetWindowThreadProcessId() to see if the process ID for the hwnd is the window you just created.
Obviously, the process may take some time to create the window, may create many windows, or may not create one at all.
J'aimerais, à partir d'un programme python, lancer un executable
windows, récupérer le handle sur sa fenetre principale et envoyer des
messages pour simuler l'appui sur des touches.
Je pense que c'est possible avec pywin32. Je sais lancer un process. Je
sais envoyer des messages à une fenetre (à l'aide de son handle). Mais
comment récupérer le handle sur la fenetre principale ?
Nicolas
Peut-être via WMI (en attribut de l'objet correspondant au process) ???
Sinon, en recherchant python + process + window + handle sur google, on
tombe sur:
http://mail.python.org/pipermail/python-list/2003-March/153917.html
-----------------------------------------------------------
Mark Hammond mhammond@skippinet.com.au
Tue, 18 Mar 2003 10:39:10 GMT
* Previous message: Window handle (hwnd) from process or thread info
* Next message: 2 UK Jobs
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Constant wrote:
The Win32 CreateProcess(), including the win32process.CreateProcess(),
function return the following info about the process that it just created:
Is it possible to get the window handle (HWND) of the window, that was
created by this process, from these pieces of information?
Use win32api.EnumWindows() to enumerate all top-level windows, then call
win32process.GetWindowThreadProcessId() to see if the process ID for the
hwnd is the window you just created.
Obviously, the process may take some time to create the window, may
create many windows, or may not create one at all.
J'aimerais, à partir d'un programme python, lancer un executable windows, récupérer le handle sur sa fenetre principale et envoyer des messages pour simuler l'appui sur des touches. Je pense que c'est possible avec pywin32. Je sais lancer un process. Je sais envoyer des messages à une fenetre (à l'aide de son handle). Mais comment récupérer le handle sur la fenetre principale ? Nicolas
Peut-être via WMI (en attribut de l'objet correspondant au process) ???
Sinon, en recherchant python + process + window + handle sur google, on tombe sur:
http://mail.python.org/pipermail/python-list/2003-March/153917.html ----------------------------------------------------------- Mark Hammond Tue, 18 Mar 2003 10:39:10 GMT
* Previous message: Window handle (hwnd) from process or thread info * Next message: 2 UK Jobs * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Constant wrote:
The Win32 CreateProcess(), including the win32process.CreateProcess(), function return the following info about the process that it just created:
Is it possible to get the window handle (HWND) of the window, that was created by this process, from these pieces of information?
Use win32api.EnumWindows() to enumerate all top-level windows, then call win32process.GetWindowThreadProcessId() to see if the process ID for the hwnd is the window you just created.
Obviously, the process may take some time to create the window, may create many windows, or may not create one at all.
Use win32api.EnumWindows() to enumerate all top-level windows, then call win32process.GetWindowThreadProcessId() to see if the process ID for the hwnd is the window you just created.
Obviously, the process may take some time to create the window, may create many windows, or may not create one at all.
Super.
Merci.
Nicolas
Use win32api.EnumWindows() to enumerate all top-level windows, then call
win32process.GetWindowThreadProcessId() to see if the process ID for the
hwnd is the window you just created.
Obviously, the process may take some time to create the window, may
create many windows, or may not create one at all.
Use win32api.EnumWindows() to enumerate all top-level windows, then call win32process.GetWindowThreadProcessId() to see if the process ID for the hwnd is the window you just created.
Obviously, the process may take some time to create the window, may create many windows, or may not create one at all.