JackDinn Posted May 22, 2009 Share Posted May 22, 2009 (edited) i cant figure out how to get a $Hbit = _ScreenCapture_Capture() into the clip board, have read and tried some udf's made for this but im even more confused now. expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <ScreenCapture.au3> #include <Clipboard.au3> $oldWhnd = 0 $hGUI = GUICreate("Clipboard", 600, 400) While 1 Sleep(100) $W_or_ctrl_hnd = getctrl() If $W_or_ctrl_hnd <> $oldWhnd Then _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) Sleep(100) If WinExists($W_or_ctrl_hnd) Then $winpos = hilightwin($W_or_ctrl_hnd) $oldWhnd = $W_or_ctrl_hnd EndIf EndIf If _IsPressed("01") Then $Hbit = _ScreenCapture_Capture($winpos[0], $winpos[1], $winpos[2], $winpos[3]) _ClipBoard_Open($hGUI) _ClipBoard_Empty() _ClipBoard_SetDataEx($Hbit, $CF_BITMAP) ;~ _ClipBoard_SetData($Hbit, $CF_BITMAP) _ClipBoard_Close() ;~ _ClipBoard_SetHBITMAP($Hbit) Exit EndIf WEnd Func getctrl() $pos = _WinAPI_GetMousePos() $Hwinx = _WinAPI_WindowFromPoint($pos) Return $Hwinx EndFunc;==>getctrl Func hilightwin($Hwin) Local $hDC, $hPen, $obj_orig Local $winposx[4] $winpos = WinGetPos($Hwin) $hDC = _WinAPI_GetWindowDC(0); DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, 5, 0x00ff00) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) $winposx[0] = $winpos[0] $winposx[1] = $winpos[1] $winposx[2] = $winpos[0] + $winpos[2] $winposx[3] = $winpos[1] + $winpos[3] _WinAPI_DrawLine($hDC, $winposx[0] + 3, $winposx[1] + 3, $winposx[2] - 3, $winposx[1] + 3) _WinAPI_DrawLine($hDC, $winposx[2] - 3, $winposx[1] + 3, $winposx[2] - 3, $winposx[3] - 3) _WinAPI_DrawLine($hDC, $winposx[2] - 3, $winposx[3] - 3, $winposx[0] + 3, $winposx[3] - 3) _WinAPI_DrawLine($hDC, $winposx[0] + 3, $winposx[3] - 3, $winposx[0] + 3, $winposx[1] + 3) _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) Return $winposx EndFunc;==>hilightwin ;; test func from AutoIt forum Func _ClipBoard_SetHBITMAP($hBitmap, $Empty = 1) _ClipBoard_Open(_AutoItWinGetHandle()) If $Empty Then _ClipBoard_Empty() _ClipBoard_SetDataEx($hBitmap, $CF_BITMAP) _ClipBoard_Close() If Not _ClipBoard_IsFormatAvailable($CF_BITMAP) Then Return SetError(1, 0, 0) EndIf EndFunc;==>_ClipBoard_SetHBITMAP _AutoItWinGetHandle() i duno what this command is so the func at the end of script dont work , and im still stuck. id like to be able to paste to Paint after capture just as a test that its working. i know its capturing the right area as i tried _ScreenCapture_Capture(@ScriptDir & "\test.jpg",$winpos[0], $winpos[1], $winpos[2], $winpos[3]) and thats ok Edited May 22, 2009 by JackDinn Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
JackDinn Posted May 22, 2009 Author Share Posted May 22, 2009 nm just me , missed the darn "" from _ScreenCapture_Capture("",$winpos[0], $winpos[1], $winpos[2], $winpos[3]) thats all, grrr. thx anyhow. Thx all,Jack Dinn. JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now