komalo Posted October 19, 2008 Share Posted October 19, 2008 (edited) hithis my first script in this forum , it is a tiny script for capture screen behind a specific windowedit : okay important improvements on the script , now it works like magicno flushing , no delayingit works fine for me but not for some users (maybe all) for unknown reasons so it seems that it will not work for any one but i will leave it here if any one wanted itDemo & a Little Function#include <WinAPI.au3> #include <Constants.au3> #include <ScreenCapture.au3> #include <WindowsConstants.au3> _CaptureBehindWindow("","", @ScriptDir & "\Behind Current window.bmp") ShellExecute(@ScriptDir & "\Behind Current window.bmp") Func _CaptureBehindWindow($sTitle, $sText, $sFile) Local Const $WS_EX_COMPOSITED = 0x2000000 $hWnd = WinGetHandle($sTitle, $sText) $Old_EX_STYLE = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($WS_EX_LAYERED, $WS_EX_COMPOSITED)) _ScreenCapture_Capture($sFile, 0, 0, -1, -1, False) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $Old_EX_STYLE) EndFunc ;==>_CaptureBehindWindow Edited October 24, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
komalo Posted October 21, 2008 Author Share Posted October 21, 2008 any opinion ? [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
spudw2k Posted October 21, 2008 Share Posted October 21, 2008 (edited) any opinion ?Might as well put the includes in there.#Include <WinAPI.au3>#Include <ScreenCapture.au3>#Include <Constants.au3>edit: Doesn't seem to work quite right. Maybe add a delay till picture is done? Edited October 21, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Marlo Posted October 21, 2008 Share Posted October 21, 2008 Very buggy =( and you also didnt specify what includes were requires Heres the screenshot that was taken on my system. (only half draws a window) Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
jvanegmond Posted October 21, 2008 Share Posted October 21, 2008 Good try, but it doesn't work that way. github.com/jvanegmond Link to comment Share on other sites More sharing options...
komalo Posted October 21, 2008 Author Share Posted October 21, 2008 Might as well put the includes in there.#Include <WinAPI.au3>#Include <ScreenCapture.au3>#Include <Constants.au3>edit: Doesn't seem to work quite right. Maybe add a delay till picture is done?Very buggy =( and you also didnt specify what includes were requires Heres the screenshot that was taken on my system. (only half draws a window)Good try, but it doesn't work that way.sorry guys , that's my first script shared here so i didn't know what to do .i put all the includes now . about that delay , the script works fine with me but maybe there's timing betweenapply the style and taking the screen shot so i modified the script and put a sleepbetween SetTrans and capture.you can try it now . [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
komalo Posted October 23, 2008 Author Share Posted October 23, 2008 (edited) okay important improvements on the script , now it works like magic no flushing , no delaying , see first post for the update Edited October 23, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
jvanegmond Posted October 23, 2008 Share Posted October 23, 2008 Still doesn't repaint the picture the area behind the window when it is needed. You should look into GDI a bit more. github.com/jvanegmond Link to comment Share on other sites More sharing options...
komalo Posted October 24, 2008 Author Share Posted October 24, 2008 first it works for me fine now so i don't really get it , why it is not captured for you second i am not using GDI Here [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2008 Share Posted October 24, 2008 (edited) What OS are you running? Vista has made a lot of changes in the way this works. Win XP SP3 here.Edit: It does work for me in most non-user drawn forms. But it still makes huge flashes. Edited October 24, 2008 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
Marlo Posted October 24, 2008 Share Posted October 24, 2008 I run the script and absolutely noting happens : / Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2008 Share Posted October 24, 2008 I run the script and absolutely noting happens : /That's because it's an UDF style script. It's an #include basically. Try this: expandcollapse popup#include <WinAPI.au3> #include <Constants.au3> #include <ScreenCapture.au3> #include <WindowsConstants.au3> ;#VARIBLES#=============================================================================== Global Const $WS_EX_COMPOSITED = 0x2000000 ;#FUNCTION#=============================================================================== ; ; Name...........: _CaptureBehindWindow ; Description ...: Capture the screen behind a specific window ; Syntax.........: _CaptureBehindWindow($sTitle , $sText , $sFile) ; Parameters ....: $sTitle = The title of the window . See Title special definition. ; $sText = text The text of the window . ; $sFile = Full path and extension of the image file to save the capture image in ; Return values .: None ; Author ........: komalo ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; _CaptureBehindWindow("","", @ScriptDir & "\Behind Current window.bmp") ; ;========================================================================================== Func _CaptureBehindWindow($sTitle, $sText, $sFile) $hWnd = WinGetHandle($sTitle, $sText) $Old_EX_STYLE = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($WS_EX_LAYERED, $WS_EX_COMPOSITED)) _ScreenCapture_Capture($sFile, 0, 0, -1, -1, False) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $Old_EX_STYLE) EndFunc ;==>_CaptureBehindWindow Opt("WinTitleMatchMode", 2) ;; THE ACTUAL SCRIPT _CaptureBehindWindow(" - SciTE", "", "C:\test.jpg") ShellExecute("C:\test.jpg") github.com/jvanegmond Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2008 Share Posted October 24, 2008 I run the script and absolutely noting happens : /That's because it's an UDF style script. It's an #include basically. Try this: expandcollapse popup#include <WinAPI.au3> #include <Constants.au3> #include <ScreenCapture.au3> #include <WindowsConstants.au3> ;#VARIBLES#=============================================================================== Global Const $WS_EX_COMPOSITED = 0x2000000 ;#FUNCTION#=============================================================================== ; ; Name...........: _CaptureBehindWindow ; Description ...: Capture the screen behind a specific window ; Syntax.........: _CaptureBehindWindow($sTitle , $sText , $sFile) ; Parameters ....: $sTitle = The title of the window . See Title special definition. ; $sText = text The text of the window . ; $sFile = Full path and extension of the image file to save the capture image in ; Return values .: None ; Author ........: komalo ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; _CaptureBehindWindow("","", @ScriptDir & "\Behind Current window.bmp") ; ;========================================================================================== Func _CaptureBehindWindow($sTitle, $sText, $sFile) $hWnd = WinGetHandle($sTitle, $sText) $Old_EX_STYLE = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($WS_EX_LAYERED, $WS_EX_COMPOSITED)) _ScreenCapture_Capture($sFile, 0, 0, -1, -1, False) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $Old_EX_STYLE) EndFunc ;==>_CaptureBehindWindow Opt("WinTitleMatchMode", 2) ;; THE ACTUAL SCRIPT _CaptureBehindWindow(" - SciTE", "", "C:\test.jpg") ShellExecute("C:\test.jpg") github.com/jvanegmond Link to comment Share on other sites More sharing options...
komalo Posted October 24, 2008 Author Share Posted October 24, 2008 (edited) That's because it's an UDF style script. It's an #include basically. Try this: expandcollapse popup#include <WinAPI.au3> #include <Constants.au3> #include <ScreenCapture.au3> #include <WindowsConstants.au3> ;#VARIBLES#=============================================================================== Global Const $WS_EX_COMPOSITED = 0x2000000 ;#FUNCTION#=============================================================================== ; ; Name...........: _CaptureBehindWindow ; Description ...: Capture the screen behind a specific window ; Syntax.........: _CaptureBehindWindow($sTitle , $sText , $sFile) ; Parameters ....: $sTitle = The title of the window . See Title special definition. ; $sText = text The text of the window . ; $sFile = Full path and extension of the image file to save the capture image in ; Return values .: None ; Author ........: komalo ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; _CaptureBehindWindow("","", @ScriptDir & "\Behind Current window.bmp") ; ;========================================================================================== Func _CaptureBehindWindow($sTitle, $sText, $sFile) $hWnd = WinGetHandle($sTitle, $sText) $Old_EX_STYLE = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, BitOR($WS_EX_LAYERED, $WS_EX_COMPOSITED)) _ScreenCapture_Capture($sFile, 0, 0, -1, -1, False) _WinAPI_SetWindowLong($hWnd, $GWL_EXSTYLE, $Old_EX_STYLE) EndFunc ;==>_CaptureBehindWindow Opt("WinTitleMatchMode", 2) ;; THE ACTUAL SCRIPT _CaptureBehindWindow(" - SciTE", "", "C:\test.jpg") ShellExecute("C:\test.jpg") @Manadar : thank you for replaying to others now i knew why it wasn't working for you if you try this _CaptureBehindWindow("Untitled -", "", "C:\test.jpg") ShellExecute("C:\test.jpg") with notepad you will not get the flushing I am XP SP2 User Edited October 24, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
Marlo Posted October 24, 2008 Share Posted October 24, 2008 I'm not a complete novice at AutoIt you know Ofc i wrote out the function yet still nothing happened. Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2008 Share Posted October 24, 2008 Yeah, so I try this:;; THE ACTUAL SCRIPT Opt("WinTitleMatchMode", 2) WinActivate("Untitled - ") _CaptureBehindWindow("Untitled -", "", "C:\test.jpg") ShellExecute("C:\test.jpg")I don't see what the difference is between getting a winhandle using the first part of the string, or the last part of the string. A window handle is a window handle.Result: You can clearly see where the window was before. github.com/jvanegmond Link to comment Share on other sites More sharing options...
komalo Posted October 24, 2008 Author Share Posted October 24, 2008 i am getting board , it works for me that what i want so i will leave this script here just for clearing the idea of the script : bitblt function doesn't get Bits by layered windows so i get the exstyle of the window and sets the exstyle to $WS_EX_LAYERED make a screencapture which is made by bitblt and sets the exstyle to the orginal [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
jvanegmond Posted October 24, 2008 Share Posted October 24, 2008 just for clearing the idea of the script :bitblt function doesn't get Bits by layered windowsso i get the exstyle of the window and sets the exstyleto $WS_EX_LAYERED make a screencapture which is made by bitblt and sets the exstyle to the orginalYou should be able to do this quite effectively using BitBlt and GetDC using a specific hWnd and not null. github.com/jvanegmond Link to comment Share on other sites More sharing options...
komalo Posted October 24, 2008 Author Share Posted October 24, 2008 (edited) ScreenCapture_Capture Uses Desktop's handle ( _WinAPI_GetDesktopWindow ) and i am able to finish it , what i don't get it is why it is not working right for you Edited November 4, 2008 by komalo [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] 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