123disconnect Posted October 14, 2019 Posted October 14, 2019 expandcollapse popup#include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Example() Func Example() Local $hBitmap, $hClone, $hImage, $iX, $iY ; Initialize GDI+ library _GDIPlus_Startup() ; Capture 32 bit bitmap $hBitmap = _ScreenCapture_Capture("") ConsoleWrite(@CRLF&@error) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) ConsoleWrite(@CRLF&@error) ; Create 24 bit bitmap clone $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB) ConsoleWrite(@CRLF&@error) ; Save bitmap to file _GDIPlus_ImageSaveToFile($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp") ConsoleWrite(@CRLF&@error) ; Clean up resources _GDIPlus_ImageDispose($hClone) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hBitmap) ; Shut down GDI+ library _GDIPlus_Shutdown() ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example Hi, Everyone Help me this code. it's taken from _GDIPlus_BitmapCloneArea Autoit help (V3.3.14.3) I don't know why the "GDIPlus_Image.bmp" file can't be saved. Error code from _GDIPlus_ImageSaveToFile is : -1 Thank.
123disconnect Posted October 14, 2019 Author Posted October 14, 2019 Done. Update autoit to V.3.3.14.5
KaFu Posted October 14, 2019 Posted October 14, 2019 A simple error in the help-file, you save to *.bmp and try to open *.jpg, change either of those and it will work. 123disconnect 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
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