Jump to content
Sign in to follow this  

Trying to capture window to clipboard using _ClipBoard_SetData() and _ScreenCapture_CaptureWnd()

Recommended Posts

Hi folks,

I am trying to accomplish a very simple task, but it seems not to work no matter what I try.

I want to open a window, and capture it to the clipboard using _ClipBoard_SetData(), without dumping screen capture to a file first and without using Send("!{PRINTSCREEN}") method.

The script below seems to be working with bitmap data, but cannot manage to put it into the clipboard once captured.

Any hints?



; Wait and allow 2 more seconds for Aero animations
$handle = WinWait("Calculator")

; Initialize GDI+ library

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_CaptureWnd("", $handle)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

; This shows data info as {B96B3CAA-0728-11D3-9D7B-0000F81EF32E} GUID, MEMORYBMP
;~ $aRet = _GDIPlus_ImageGetRawFormat($hImage)
;~ MsgBox(0,"dbg",$aRet[0])
;~ MsgBox(0,"dbg",$aRet[1])

; Trying to put image in clipboard <- This is what seems to be failing ...

; Clean up resources
; Shut down GDI+ library

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...