Jump to content

Screen shot and paste


Recommended Posts

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

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...