Jump to content

ScreenCapture_CaptureWnd


Madza91
 Share

Recommended Posts

Hello... How to Capture Window when is outside of visible screen?

Here is demo:

#include <ScreenCapture.au3>
$image = @DesktopDir & "\slika.jpg"
$Form1 = GUICreate("Form1", 400, 400, @DesktopWidth-200, -1)
$Button1 = GUICtrlCreateButton("Button1", 160, 120, 80, 25, 0)
GUISetState(@SW_SHOW)
Sleep(200)

_ScreenCapture_CaptureWnd($image, $Form1)
ShellExecute($image)

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

This?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>

Global Const $SPI_GETWORKAREA = 48
Global Const $WM_EXITSIZEMOVE  = 0x232

Global $sImageFile = @DesktopDir & "\slika.jpg"

$hGUI = GUICreate("Dock GUI form to screen edges", 350, 200)

$cDummy = GUICtrlCreateDummy()

GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE")

GUISetState()

While 1 
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cDummy
            _ScreenCapture_CaptureWnd($sImageFile, $hGUI)
    EndSwitch
WEnd

Func WM_EXITSIZEMOVE($hWnd, $Msg, $wParam, $lParam)
    Local $iDocked = False, $iStickVal = 20
    
    Local $aWinPos = WinGetPos($hWnd)
    
    Local $tRECT = DllStructCreate("int Left;int Top;int Right;int Bottom")
    
    Local $aRet = DllCall("user32.dll", "int", "SystemParametersInfo", "uint", $SPI_GETWORKAREA, "uint", 0, _
                          "ptr", DllStructGetPtr($tRECT), "uint", 0)
    
    Local $iX = $aWinPos[0]
    Local $iY = $aWinPos[1]
    Local $iWidth = $aWinPos[2]
    Local $iHeight = $aWinPos[3]
    
    Local $iLeft = DllStructGetData($tRECT, "Left")
    Local $iTop = DllStructGetData($tRECT, "Top")
    Local $iRight = DllStructGetData($tRECT, "Right")
    Local $iBottom = DllStructGetData($tRECT, "Bottom")
    
    If ($iX < $iLeft) Or ($iY < $iTop) Or ($iX + $iWidth > $iRight) Or ($iY + $iHeight > $iBottom) Then GUICtrlSendToDummy($cDummy)
    
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_EXITSIZEMOVE
Link to comment
Share on other sites

Yes. :)

Is it possible?

Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
Share on other sites

Hello... How to Capture Window when is outside of visible screen?

Here is demo:

#include <ScreenCapture.au3>
$image = @DesktopDir & "\slika.jpg"
$Form1 = GUICreate("Form1", 400, 400, @DesktopWidth-200, -1)
$Button1 = GUICtrlCreateButton("Button1", 160, 120, 80, 25, 0)
GUISetState(@SW_SHOW)
Sleep(200)

_ScreenCapture_CaptureWnd($image, $Form1)
ShellExecute($image)
n3ne

Happy New Year :)

I know I had seen something on this before in dev chat, can't help you on this one though.

these are the relevant links.

btw, ease off on the dry.gif :lmao:

Cheers

Get control screenshot as bitmap, from another application

http://www.autoitscript.com/forum/index.php?showtopic=71629

Need advice on advanced image capture attempt, (for images larger than the screen can display)

http://www.autoitscript.com/forum/index.php?showtopic=80882

Window Visible (Taskbar)

http://www.autoitscript.com/forum/index.php?showtopic=85984

PixelGetColor for a minimized window

http://www.autoitscript.com/forum/index.ph...&hl=capture

I see fascists...

Link to comment
Share on other sites

  • Moderators

Yes. :)

Is it possible?

What is with the smug look at someone trying to help you?

The answer despite what anyone else says is NO, and if you had searched, you would have seen it several times!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@n3nE

Example:

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#Include <ScreenCapture.au3>

Run("Notepad.exe")
WinWait("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")

$aWinPos = WinGetPos($hWnd)
WinMove($hWnd, "", -200, $aWinPos[1])

MsgBox(0, "Message", "Now we capture the notepad window")

$hDC = _WinAPI_GetWindowDC($hWnd)
$hMemDC = _WinAPI_CreateCompatibleDC($hDC)

$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aWinPos[2], $aWinPos[3])
_WinAPI_SelectObject($hMemDC, $hBitmap)

_PrintWindow($hWnd, $hMemDC)

_WinAPI_DeleteDC($hMemDC)
_WinAPI_ReleaseDC($hWnd, $hDC)

Dim $sFile = @ScriptDir & "\capture.jpg"

_ScreenCapture_SaveImage($sFile, $hBitmap)
ShellExecute($sFile)

Func _PrintWindow($hWnd, $hMemDC, $iFlag = 0)
    $aRet = DllCall("User32.dll", "int", "PrintWindow", _
                                         "hwnd", $hWnd, _
                                         "hwnd", $hMemDC, _
                                         "int", $iFlag)
    Return $aRet[0]
EndFunc   ;==>_PrintWindow

:)

Edit: added a return value.

Edited by rasim
Link to comment
Share on other sites

Oh Rasim... I don't know what to say... Everything is possible? :think:

Thank You!

Happy New Year :)

Happy New Year too :shhh:

btw, ease off on the dry.gif :>

Sorry for that :lmao:

@SmOke_N... Happy now year ;)

Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...