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

_Main()

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

	; Инициализация библиотеки GDI+
	_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_PXF24RGB)

	; Save bitmap to file
	_GDIPlus_ImageSaveToFile ($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp")

	; Очищает ресурсы
	_GDIPlus_ImageDispose ($hClone)
	_GDIPlus_ImageDispose ($hImage)
	_WinAPI_DeleteObject ($hBitmap)

	; Закрывает библиотеку GDI+
	_GDIPlus_ShutDown ()

EndFunc   ;==>_Main