Jump to content

Recommended Posts

Posted

Well, I'm trying to find a way to screen shot an active window, then pasting it on a paint document. I have no clue about this and any advice would be apricated.

Posted

Hi,

Tried this in win xp, adapt it to suite your needs.

It opens MS Paint, captures the MS Paint window and pastes the capture into the same MS Paint window.

;code by UEZ, adapted by smashly.
#include <Clipboard.au3>
#include <ScreenCapture.au3>

Run("mspaint.exe")
WinWait("[CLASS:MSPaintApp]", "", 5)
WinActivate("[CLASS:MSPaintApp]")

$err = False
$hHBITMAP = _ScreenCapture_CaptureWnd("", WinGetHandle(""))
If Not _ClipBoard_Open(0) Then
    $err = @error
    $err_txt = "_ClipBoard_Open failed!"
EndIf
If Not _ClipBoard_Empty() Then
    $err = @error
    $err_txt = "_ClipBoard_Empty failed!"
EndIf
If Not _ClipBoard_SetDataEx($hHBITMAP, $CF_BITMAP) Then
    $err = @error
    $err_txt = "_ClipBoard_SetDataEx failed!"
EndIf
_ClipBoard_Close()
_WinAPI_DeleteObject($hHBITMAP)
If Not $err Then
    Send("^v")
Else
    MsgBox(0, "Error", "An error has occured: " & $err_txt, 10)
EndIf

Cheers

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
  • Recently Browsing   0 members

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