Sign in to follow this  
Followers 0
UnknownWarrior

Pasting (ClipPut) Image to GUI

3 posts in this topic

#include <IE.au3>
#include <Clipboard.au3>
#include <GDIPlus.au3>
#Include <Memory.au3>
$oIE = _IECreate('www.google.com');;;example
$oImg = _IEImgGetCollection($oIE, 0)
$oRange = $oIE.document.Body.CreateControlRange()
$oRange.Add($oImg)
$oRange.ExecCommand('Copy')
_GDIPlus_Startup()
$hImage = _ClipBoard_GetData($CF_BITMAP)
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
MsgBox(0,"",$iX & "   " & $iY)

Keeps returning a HUGE number, and 0 (for y). That huge number for x could be real, beings the measurement is in pixels... but '0' is obviously wrong for the y value.

If you go to MS Paint (or whatever), and 'Paste', you get the image there (it's just a mixture of images of Google-related stuff, but the point is there).

After I can get the image details correctly, I should be able to use this to get the image to the GUI:

$oBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hImage)
$Gui = GUICreate('IE Image', 400, 400, 250, 250)
GUISetState()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
_GDIPlus_GraphicsDrawImage($hGraphic, $oBitmap, 0, 0)

Sleep(10000)

Thanks for any help!

Share this post


Link to post
Share on other sites



Try this:

#include <IE.au3>
#include <Clipboard.au3>
#include <GDIPlus.au3>
#Include <Memory.au3>
$oIE = _IECreate('www.google.com');;;example
$oImg = _IEImgGetCollection($oIE, 0)
$oRange = $oIE.document.Body.CreateControlRange()
$oRange.Add($oImg)
$oRange.ExecCommand('Copy')
_ClipBoard_Open(0)
$hHBitmap = _ClipBoard_GetDataEx($CF_BITMAP)
_ClipBoard_Close()

_GDIPlus_Startup()
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)
$iX = _GDIPlus_ImageGetWidth($hImage)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iX = ' & $iX & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$iY = _GDIPlus_ImageGetHeight($hImage)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iY = ' & $iY & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

$Gui = GUICreate('IE Image', 400, 400, 250, 250)
GUISetState()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)

While GUIGetMsg() <> -3
WEnd

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Ergg... didn't catch those 2 functions... Thanks!

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  
Followers 0