Rei10 Posted January 6, 2020 Posted January 6, 2020 #include <IE.au3> #include <ScreenCapture.au3> $sUrl = 'https://youtube.com' ;Local $oIE = _IECreate ($sUrl, 1); works here Local $oIE = _IECreate ($sUrl, 1, 0); not working here _IELoadWait($oIE) WinActivate(_IEPropertyGet($oIE, 'hwnd')) $hWnd = _IEPropertyGet($oIE, 'hwnd') _ScreenCapture_CaptureWnd('C:\1.jpg', $hWnd, 0, 0, 800, 800)
UEZ Posted January 6, 2020 Posted January 6, 2020 Try this: 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Rei10 Posted January 7, 2020 Author Posted January 7, 2020 Uez, thank you. There is a lot of superfluous in the code. Here is the best solution if someone is looking: 1. Make the window visible and hidden behind the program form. 2. I take a screenshot of an inactive window. #include <GDIPlus.au3> #include <WinAPIEx.au3> #include <APIConstants.au3> $iHandle = WinGetHandle('[CLASS:Notepad]') _GDIPlus_Startup() $hBitmap = Capture_Window($iHandle) _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Test.jpg") _GDIPlus_BitmapDispose($hBitmap) ;ShellExecute(@ScriptDir & "\Test.jpg") _GDIPlus_Shutdown() Func Capture_Window($hWnd) Local $hDC_Capture = _WinAPI_GetWindowDC($hWnd) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, _WinAPI_GetWindowWidth($hWnd), _WinAPI_GetWindowHeight($hWnd)) Local $hObjectOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) DllCall("user32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) Local $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) _WinAPI_SelectObject($hMemDC, $hObjectOld) _WinAPI_DeleteObject($hHBitmap) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) Return $hBmp EndFunc
Nine Posted January 7, 2020 Posted January 7, 2020 Even in yours, you got superfluous code : #include <WinAPIGdi.au3> #include <ScreenCapture.au3> Local $hWnd = WinGetHandle("[CLASS:Notepad]") Capture_Window($hWnd, 650, 500) ShellExecute("test.jpg") Func Capture_Window($hWnd, $w, $h) Local $hDC_Capture = _WinAPI_GetDC($hWnd) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $w, $h) Local $hObject = _WinAPI_SelectObject($hMemDC, $hHBitmap) _WinAPI_PrintWindow($hWnd, $hMemDC) _ScreenCapture_SaveImage("test.jpg", $hHBitmap) _WinAPI_DeleteDC($hMemDC) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>Capture_Window “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
KaFu Posted January 8, 2020 Posted January 8, 2020 The solution UEZ posted takes a screenshot invisibly and not only in the background, but of course is limited to webpages, which seems to be the intention of the OP. Here's my latest update on the code provided originally by ward: OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
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