Приветствую, форумчане
Код элементарный, под семерку идет, а вот с xp проблема. Надеюсь, укажете на пробел в знаниях.

AutoIt код:
#include <ScreenCapture.au3>
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
MakeScreenShot()
Exit
Func MakeScreenShot()
Dim $hCloneHBmp
$ActiveWindow = WinGetHandle("[active]")
if $ActiveWindow=="" Then Return 0
$Pos = WinGetClientSize("[active]")
if $Pos==0 Then Return 0
$proc = WinGetProcess("[active]")
$filename = @YEAR & @MON & @MDAY & "-" & @HOUR & @MIN & @SEC
_GDIPlus_Startup()
$HBITMAP = _ScreenCapture_CaptureWnd ("", $ActiveWindow, 0, 0, $Pos[0], $Pos[1], False)
$fFreeBmp = True
$hBmp = _GDIPlus_BitmapCreateFromHBITMAP($HBITMAP)
$hContext = _GDIPlus_ImageGetGraphicsContext($hBmp)
;$hClone = $hBmp
;_Greyscale($hBmp, $hContext)
$hClone = _GDIPlus_BitmapCloneArea( $hBmp, 0, 0, $Pos[0], $Pos[1], $GDIP_PXF08INDEXED)
$hCloneHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hClone)
ConsoleWrite(GetPixSum($HBITMAP) & @LF)
_GDIPlus_ImageSaveToFile($hClone, @ScriptDir & "\" & $filename & ".png")
_GDIPlus_GraphicsDispose($hContext)
_WinAPI_DeleteObject($HBITMAP)
_GDIPlus_BitmapDispose ($hClone)
_GDIPlus_BitmapDispose ($hBmp)
_GDIPlus_Shutdown()
EndFunc
Func GetPixSum($hBitmp)
Dim $pBit, $hDib, $iCRC, $hDC, $hSv, $tSize
$tSize = _WinAPI_GetBitmapDimension($hBitmp)
$hDC = _WinAPI_CreateCompatibleDC(0)
$hDib = _WinAPI_CreateDIB(DllStructGetData($tSize, 1), DllStructGetData($tSize, 2), 24)
$pBit = _WinAPI_GetExtended()
$hSv = _WinAPI_SelectObject($hDC, $hDib)
_WinAPI_DrawBitmap($hDC, 0, 0, $hBitmp, $MERGECOPY)
_WinAPI_SelectObject($hDC, $hSv)
$iCRC = _WinAPI_ComputeCrc32($pBit, DllStructGetData($tSize, 1) * DllStructGetData($tSize, 2) * 3)
_WinAPI_DeleteDC($hDC)
Return $iCRC
EndFunc
Func _Greyscale($hImage, $hImageContext)
Local $tNegMatrix, $pNegMatrix, $hIA
$hIA = _GDIPlus_ImageAttributesCreate()
$aImageSize = _GDIPlus_ImageGetDimension($hImage)
If $hImage Then
$tNegMatrix = _GDIPlus_ColorMatrixCreateGrayScale()
$pNegMatrix = DllStructGetPtr($tNegMatrix)
_GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $pNegMatrix)
_GDIPlus_GraphicsDrawImageRectRectIA($hImageContext, $hImage, 0, 0, $aImageSize[0], $aImageSize[1], 0, 0, $aImageSize[0], $aImageSize[1], $hIA)
_GDIPlus_ImageAttributesDispose($hIA)
EndIf
EndFunc
Func _GDIPlus_ImageGetDimension($hImage)
Local $aSize[2], $aResult
$aResult = DllCall($ghGDIPDll, "uint", "GdipGetImageDimension", "hwnd", $hImage, "float*", 0, "float*", 0)
If @error Then Return SetError(@error, @extended, -1)
$GDIP_STATUS = $aResult[0]
If $GDIP_STATUS Then Return -1
$aSize[0] = $aResult[2]
$aSize[1] = $aResult[3]
Return $aSize
EndFunc ;==>_GDIPlus_ImageGetDimension
Func _GDIPlus_ImageAttributesCreate()
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateImageAttributes", "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
Return $aResult[1]
EndFunc ;==>_GDIPlus_ImageAttributesCreate
Func _GDIPlus_ColorMatrixCreateGrayScale()
Local Const $GDIP_RLUM = 0.3086
Local Const $GDIP_GLUM = 0.6094
Local Const $GDIP_BLUM = 0.0820
Local Const $tagGDIPCOLORMATRIX = "float m[25];"
Local $iI, $iJ, $tCM, $aLums[4] = [$GDIP_RLUM, $GDIP_GLUM, $GDIP_BLUM, 0]
$tCM = DllStructCreate($tagGDIPCOLORMATRIX)
For $iI = 0 To 3
For $iJ = 1 To 3
DllStructSetData($tCM, "m", $aLums[$iI], $iI * 5 + $iJ)
Next
Next
DllStructSetData($tCM, "m", 1, 19)
DllStructSetData($tCM, "m", 1, 25)
Return $tCM
EndFunc ;==>_GDIPlus_ColorMatrixCreateGrayScale
Func _GDIPlus_ImageAttributesSetColorMatrix($hImageAttributes, $iColorAdjustType = 0, $fEnable = False, $pClrMatrix = 0, $pGrayMatrix = 0, $iColorMatrixFlags = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetImageAttributesColorMatrix", "hwnd", $hImageAttributes, "int", $iColorAdjustType, "int", $fEnable, "ptr", $pClrMatrix, "ptr", $pGrayMatrix, "int", $iColorMatrixFlags)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_ImageAttributesSetColorMatrix
Func _GDIPlus_GraphicsDrawImageRectRectIA($hGraphics, $hImage, $nSrcX, $nSrcY, $nSrcWidth, $nSrcHeight, $nDstX, $nDstY, $nDstWidth, $nDstHeight, $hImageAttributes = 0, $iUnit = 2)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRect", "hwnd", $hGraphics, "hwnd", $hImage, "float", $nDstX, "float", _
$nDstY, "float", $nDstWidth, "float", $nDstHeight, "float", $nSrcX, "float", $nSrcY, "float", $nSrcWidth, "float", _
$nSrcHeight, "int", $iUnit, "hwnd", $hImageAttributes, "int", 0, "int", 0)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectIA
Func _GDIPlus_ImageAttributesDispose($hImageAttributes)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDisposeImageAttributes", "hwnd", $hImageAttributes)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_ImageAttributesDispose