Jump to content

The screen capture


yxiany
 Share

Recommended Posts

Test aim: obtain a bmp file of 1 pbb through screen capture.

Test way: the source code below is used to get the bmp file of 1 pbb in boot D:\.

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
        Local $hBitmap, $hClone, $hImage, $iX, $iY

        ; Initialize GDI+ library
        _GDIPlus_StartUp ()

        ; Capture 32 bit bitmap
        $hBitmap = _ScreenCapture_Capture ("")
        $hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

        ; Create 24 bit bitmap clone
        $iX = _GDIPlus_ImageGetWidth ($hImage)
        $iY = _GDIPlus_ImageGetHeight ($hImage)
        $hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF01INDEXED);$GDIP_PXF01INDEXED $GDIP_PXF24RGB

        ; Save bitmap to file
        _GDIPlus_ImageSaveToFile ($hClone, "D:\GDIPlus_Image.bmp")

        ; Clean up resources
        _GDIPlus_ImageDispose ($hClone)
        _GDIPlus_ImageDispose ($hImage)
        _WinAPI_DeleteObject ($hBitmap)

        ; Shut down GDI+ library
        _GDIPlus_ShutDown ()

EndFunc   ;==>_Main

Test result: no bmp file is generated in boot d:\

Try again: The GDIPlus_Image.bmp file is got in boot D: if $GDIP_PXF01INDEXED is replaced by $GDIP_PXF24RGB in the "_GDIPlus_BitmapCloneArea()" function.

Question: how to obtain a bmp file of 1 bpp?

Thanks!

Edited by yxiany
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...