[..] Prendre une capture d'écran d'une fênetre non visible
Posté : mer. 16 oct. 2019 11:45
Bonjour.
Actuellement, je code un script, et au sein de celui ci, j'aurais besoin d'ouvrir un programme, de le rendre non visible, et de capturer la fenêtre...
Quand je dis "non visible", et non pas "invisible", je parle de déplacer la fenêtre hors champ, avec un petit winmove...
Après recherche, pour faire une capture simple, j'ai pris l'exemple avec le bloc note, que voici :
Ca fonctionne.
Mais si je fais un WinMove pour mettre la fenêtre hors champ, on voit sur l'image, la fenetre coupé en deux.
En gros, on voit 'l'hors champ' ^^
Comment faire pour capturer une fenêtre, sans qu'elle soit visible ? Telle est la question.
Ce que j'ai fait, au final :
Ce que j'aimerais trouvé, et que je vais essayer de trouver, c'est comment ouvrir une fenêtre d'un programme directement non visible, et que je puisse capturer son image.
Merci de vouloir m'aider à trouver des pistes...
++
Actuellement, je code un script, et au sein de celui ci, j'aurais besoin d'ouvrir un programme, de le rendre non visible, et de capturer la fenêtre...
Quand je dis "non visible", et non pas "invisible", je parle de déplacer la fenêtre hors champ, avec un petit winmove...
Après recherche, pour faire une capture simple, j'ai pris l'exemple avec le bloc note, que voici :
#include <ScreenCapture.au3>
#include <GUIConstantsEx.au3>
$img = @DesktopDir & "\img.jpg"
FileDelete($img)
$hWnd = "[CLASS:Notepad]"
ProcessClose("notepad.exe")
Run("notepad.exe")
WinWait($hWnd)
$objCurrentWindow = WinGetHandle($hWnd)
WinActivate($hWnd)
;~ WinSetState($hWnd,"",@SW_HIDE)
;~ sleep(1000)
_ScreenCapture_CaptureWnd($img, $objCurrentWindow)
ShellExecute($img)
#include <GUIConstantsEx.au3>
$img = @DesktopDir & "\img.jpg"
FileDelete($img)
$hWnd = "[CLASS:Notepad]"
ProcessClose("notepad.exe")
Run("notepad.exe")
WinWait($hWnd)
$objCurrentWindow = WinGetHandle($hWnd)
WinActivate($hWnd)
;~ WinSetState($hWnd,"",@SW_HIDE)
;~ sleep(1000)
_ScreenCapture_CaptureWnd($img, $objCurrentWindow)
ShellExecute($img)
Mais si je fais un WinMove pour mettre la fenêtre hors champ, on voit sur l'image, la fenetre coupé en deux.
En gros, on voit 'l'hors champ' ^^
Comment faire pour capturer une fenêtre, sans qu'elle soit visible ? Telle est la question.
Ce que j'ai fait, au final :
#include <ScreenCapture.au3>
#include <GUIConstantsEx.au3>
$img = @DesktopDir & "\img.jpg"
FileDelete($img)
$hWnd = "[CLASS:Notepad]"
ProcessClose("notepad.exe")
Run("notepad.exe")
WinWait($hWnd)
$objCurrentWindow = WinGetHandle($hWnd)
WinActivate($hWnd)
WinMove($hWnd,"",-500,-500)
;~ WinSetState($hWnd,"",@SW_HIDE)
sleep(1000)
_ScreenCapture_CaptureWnd($img, $objCurrentWindow)
ShellExecute($img)
#include <GUIConstantsEx.au3>
$img = @DesktopDir & "\img.jpg"
FileDelete($img)
$hWnd = "[CLASS:Notepad]"
ProcessClose("notepad.exe")
Run("notepad.exe")
WinWait($hWnd)
$objCurrentWindow = WinGetHandle($hWnd)
WinActivate($hWnd)
WinMove($hWnd,"",-500,-500)
;~ WinSetState($hWnd,"",@SW_HIDE)
sleep(1000)
_ScreenCapture_CaptureWnd($img, $objCurrentWindow)
ShellExecute($img)
Merci de vouloir m'aider à trouver des pistes...
++