Jump to content
Sign in to follow this  
komalo

another screencapture way ? [NOTNEEDED]

Recommended Posts

komalo

hi

is there's another way to capture screen besides bitblt & Send({PRINTSCREEN}) Key ?

Edited 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]

Share this post


Link to post
Share on other sites
TehWhale

I do not think so.

But why would you need any other?

Yeah, there is.

Look at the screen capture UDF.

_ScreenCapture_Capture() I belive is what it is. Take a look at the helpfile :mellow:

Share this post


Link to post
Share on other sites
Malkey

@Kragen : well the problem that i need to preform

blur on the screen captured and i am

using gdiplus so i need to convert the

hbitmap to bitmap object with gdiplus

and preform blur then convert it to hbitmap

so it preforms lots of CPU Usage

@TehWhale : _ScreenCapture_Capture() is a UDF of bitblt

This modified script from here

http://www.autoitscript.com/forum/index.ph...st&p=458911

screen captures a blurred screen and save it to BlurScrn.png on desktop.

It does not work every time. Sometimes a part of the screen refreshes, I do not know why, and that part of the screen looses its blur effect. Just press Blur button and try again.

#include <GUIConstants.au3>
#include <ScreenCapture.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

; http://www.autoitscript.com/forum/index.php?s=&showtopic=61057&view=findpost&p=458911
$hGUI = GUICreate("Blurp", 200, 120)
GUICtrlCreateLabel("InterpolationMode", 20, 20, 100, 20)
GUICtrlCreateLabel("Stretch ratio", 20, 50, 100, 20)
$cInputIM = GUICtrlCreateInput("6", 120, 15, 50, 20)
GUICtrlSetTip(-1, "Possible values" & @CRLF & "0 - 7")
$cInputSR = GUICtrlCreateInput("6", 120, 45, 50, 20)
GUICtrlSetTip(-1, "Possible values" & @CRLF & "1.0 - @DesktopHeight.0")
$cBtnBlur = GUICtrlCreateButton("Blur", 20, 80, 80, 20)
$cBtnClear = GUICtrlCreateButton("Clear", 100, 80, 80, 20)
GUISetState()

_GDIPlus_Startup()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GDIPlus_Shutdown()
            Exit
        Case $cBtnBlur
            GUISetState(@SW_HIDE, $hGUI)
            Sleep(1000)
            _ScreenBlur(GUICtrlRead($cInputSR), GUICtrlRead($cInputIM))
            Sleep(3000)
            GUISetState(@SW_SHOW, $hGUI)
        Case $cBtnClear
            _ScreenClear()
    EndSwitch
WEnd

Func _ScreenClear()
    _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_UPDATENOW + $RDW_ALLCHILDREN)
EndFunc   ;==>_ScreenClear
Func _ScreenBlur($nRatio, $iInterMode, $iSmoothMode = 0, $iPixOffsetMode = 2)

    $hBMP = _ScreenCapture_Capture("", 0, 0, -1, -1, False)
    $hImg = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)

    $hScreenDC = _WinAPI_GetDC(0)
    $hScreenGraph = _GDIPlus_GraphicsCreateFromHDC($hScreenDC)

    $hImg2 = _GDIPlus_BitmapCloneArea($hImg, 0, 0, @DesktopWidth / $nRatio, @DesktopHeight / $nRatio)
    $hMemGraph = _GDIPlus_ImageGetGraphicsContext($hImg2)
    $a = DllCall("gdiplus.dll", "int", "GdipSetInterpolationMode", "hwnd", $hMemGraph, "int", $iInterMode)
    $a = DllCall("gdiplus.dll", "int", "GdipSetInterpolationMode", "hwnd", $hScreenGraph, "int", $iInterMode)
    $a = DllCall("gdiplus.dll", "int", "GdipSetPixelOffsetMode", "hwnd", $hMemGraph, "int", $iPixOffsetMode)
    $a = DllCall("gdiplus.dll", "int", "GdipSetPixelOffsetMode", "hwnd", $hScreenGraph, "int", $iPixOffsetMode)
    $a = DllCall("gdiplus.dll", "int", "GdipSetSmoothingMode", "hwnd", $hMemGraph, "int", $iSmoothMode)
    $a = DllCall("gdiplus.dll", "int", "GdipSetSmoothingMode", "hwnd", $hScreenGraph, "int", $iSmoothMode)

    _GDIPlus_GraphicsDrawImageRectRect($hMemGraph, $hImg, 0, 0, @DesktopWidth, @DesktopHeight, 0, 0, @DesktopWidth / $nRatio, @DesktopHeight / $nRatio)
    _GDIPlus_GraphicsDrawImageRectRect($hScreenGraph, $hImg2, 0, 0, @DesktopWidth / $nRatio, @DesktopHeight / $nRatio, 0, 0, @DesktopWidth, @DesktopHeight)

    _ScreenCapture_Capture(@DesktopCommonDir & "\BlurScrn.png")

    _WinAPI_DeleteObject($hBMP)
    _GDIPlus_ImageDispose($hImg)
    _GDIPlus_ImageDispose($hImg2)
    _GDIPlus_GraphicsDispose($hMemGraph)
    _GDIPlus_GraphicsDispose($hScreenGraph)
    _WinAPI_ReleaseDC(0, $hScreenDC)

EndFunc   ;==>_ScreenBlur

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.