Jump to content

can`t pick up a bitmap from graphic object ,, please help


Recommended Posts

i just cant figure out why this dont work, why can i not generate a bitmap from a graphic object, clear the graphic object and then put the bitmap back onto the graphic object?? all im getting is a blank.

#include <GUIConstants.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

; Create GUI
$hWnd = GUICreate("GDI+ Example", 500, 500,500)
GUISetState()

; Start GDI+
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsClear($hGraphics)

; Take Screenshot at bottom left of screen
$hScreenCap_hBitmap = _ScreenCapture_Capture("", 0, @DesktopHeight - 500, 500, @DesktopHeight)
$hScreenCap_Bitmap = _GDIPlus_BitmapCreateFromHBITMAP($hScreenCap_hBitmap)

;draw image
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hScreenCap_Bitmap, 0, 0, 500, 500)
MsgBox(0,"","")

;get image into a bitmap
$bit=_GDIPlus_BitmapCreateFromGraphics (500,500,$hGraphics)
$fred=_GDIPlus_BitmapCreateFromHBITMAP ($bit)

;clear the graphics object but keep the bitmap
_GDIPlus_GraphicsClear($hGraphics)
MsgBox(0,"","")

;draw the bitmap back onto the graphic object
_GDIPlus_GraphicsDrawImageRect($hGraphics, $fred, 0, 0, 500, 500)
MsgBox(0,"","")



; Clean up resources
_WinAPI_DeleteObject($hScreenCap_hBitmap)
_GDIPlus_BitmapDispose($hScreenCap_Bitmap)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()

any help would be great as i can then continue with my project, so thx

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

_GDIPlus_BitmapCreateFromGraphics doesn't copy the contents of the graphics object into the new bitmap, the bitmap only gets the same format as the graphics object.

Use _GDIPlus_ImagegetGraphicsContext instead to get a graphics object to the bitmap.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

_GDIPlus_BitmapCreateFromGraphics doesn't copy the contents of the graphics object into the new bitmap, the bitmap only gets the same format as the graphics object.

Use _GDIPlus_ImagegetGraphicsContext instead to get a graphics object to the bitmap.

kk got it, thx for the help

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

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