PlayHD Posted May 28, 2012 Share Posted May 28, 2012 Hy guys... i have a question... How i can take a screenshot to a incative window (minimized from example)? Thanks in advance My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
JohnOne Posted May 28, 2012 Share Posted May 28, 2012 As far as I am aware, you cannot take a screenshot of minimized window. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
UEZ Posted May 28, 2012 Share Posted May 28, 2012 (edited) For minimized windows you cannot take a screen afaik but from inactive even windows which are behind others. expandcollapse popup;coded by UEZ 2012 #include <Array.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> $aWinlist = GetAllWindow() For $i = 0 To UBound($aWinlist) - 1 $hWnd = $aWinlist[$i][1] If Not WinActive($hWnd) Then ExitLoop Next If $i = UBound($aWinlist) Then Exit MsgBox(0, "Info", "No inactive window found", 10) _GDIPlus_Startup() $hBitmap = Capture_Window($hWnd, 300, 200) _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "Test.jpg") _GDIPlus_BitmapDispose($hBitmap) ShellExecute(@ScriptDir & "Test.jpg") _GDIPlus_Shutdown() Exit Func Capture_Window($hWnd, $w, $h) Local $hDC_Capture = _WinAPI_GetWindowDC($hWnd) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $w, $h) Local $hObject = _WinAPI_SelectObject($hMemDC, $hHBitmap) DllCall("user32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) _WinAPI_DeleteDC($hMemDC) Local $hObject = _WinAPI_SelectObject($hMemDC, $hObject) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) Local $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) _WinAPI_DeleteObject($hHBitmap) Return $hBmp EndFunc ;==>Capture_Window Func GetAllWindow() ;code by Authenticity - modified by UEZ Local $aWin = WinList(), $aWindows[1][4] Local $iStyle, $iEx_Style, $iCounter = 0 Local $i, $hWnd_state, $aWinPos For $i = 1 To $aWin[0][0] $iEx_Style = BitAND(_WinAPI_GetWindowLong($aWin[$i][1], $GWL_EXSTYLE), $WS_EX_TOOLWINDOW) $iStyle = BitAND(WinGetState($aWin[$i][1]), 2) If $iEx_Style <> -1 And Not $iEx_Style And $iStyle Then $aWinPos = WinGetPos($aWin[$i][1]) If $aWinPos[2] > 1 And $aWinPos[3] > 1 Then $aWindows[$iCounter][0] = $aWin[$i][0] $aWindows[$iCounter][1] = $aWin[$i][1] $aWindows[$iCounter][2] = $aWinPos[2] $aWindows[$iCounter][3] = $aWinPos[3] $iCounter += 1 EndIf ReDim $aWindows[$iCounter + 1][4] EndIf Next ReDim $aWindows[$iCounter][4] Return $aWindows EndFunc ;==>GetAllWindow Br, UEZ Edited May 28, 2012 by UEZ PlayHD 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
PlayHD Posted May 28, 2012 Author Share Posted May 28, 2012 oh thanks... is good one more question, is posible to set another function when is pressed minimize button eg: Press Minimize button from a window (no matter what) Window is hided (@SW_HIDE) Thanks again ! My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
Andreik Posted May 28, 2012 Share Posted May 28, 2012 Something like this? $hMain = GUICreate('Example') GUISetState(@SW_SHOW,$hMain) While True $nMsg = GUIGetMsg() Switch $nMsg Case -3 ; Close (X Button) Exit Case -4 ; Minimize (_ Button) GUISetState(@SW_HIDE,$hMain) EndSwitch Sleep(10) WEnd When the words fail... music speaks. Link to comment Share on other sites More sharing options...
PlayHD Posted May 28, 2012 Author Share Posted May 28, 2012 Something like this? $hMain = GUICreate('Example') GUISetState(@SW_SHOW,$hMain) While True $nMsg = GUIGetMsg() Switch $nMsg Case -3 ; Close (X Button) Exit Case -4 ; Minimize (_ Button) GUISetState(@SW_HIDE,$hMain) EndSwitch Sleep(10) WEnd No.. i mean a window (eg : a Explorer Window (C:Program Files) or Browser Window) not a autoit window My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
Andreik Posted May 28, 2012 Share Posted May 28, 2012 Try this: While True $hWnd = WinGetHandle('[active]') If WinGetState($hWnd) = 23 Then WinSetState($hWnd,'',@SW_HIDE) Sleep(10) WEnd PlayHD 1 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
PlayHD Posted May 28, 2012 Author Share Posted May 28, 2012 Try this: While True $hWnd = WinGetHandle('[active]') If WinGetState($hWnd) = 23 Then WinSetState($hWnd,'',@SW_HIDE) Sleep(10) WEnd thanks My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now