Jump to content

Recommended Posts

Posted (edited)

in windows 8 the games in windowed mode when you do the screenshot the image is black ho i can detect the black screen? i've found this and i 've tried to change with the screen capture but don't work

Func _isBlackScreen()
    Local $hImage, $iW, $iH, $tBitmapData, $iStride, $iScan0, $sRet
    Local $hBmp, $hBitmap, $hGraphic, $tCodeBuffer, $bytecode, $tPixelData
    _GDIPlus_Startup()

    $hBitmap = _ScreenCapture_Capture()
        $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
    $iW = _GDIPlus_ImageGetWidth($hImage)
    $iH = _GDIPlus_ImageGetHeight($hImage)

    ;=> Start Work around For XP, GDIPBitmapLockBits() seem to hard crash autoit When using images that are less then 24bpp
    ; If your using Vista or Newer OS then this won't be called or needed.
    ; http://www.autoitscript.com/forum/index.php?showtopic=102626&view=findpost&p=728034
    If StringInStr("WIN_2003,WIN_XP,WIN_2000", @OSVersion) Then
        Local $aRet, $hBmp, $hBitmap, $hGraphic
        $aRet = _GDIPlus_ImageGetPixelFormat($hImage)
        If Int(StringRegExpReplace($aRet[1], "\D+", "")) < 24 Then
            $hBmp = _WinAPI_CreateBitmap($iW, $iH, 1, 32)
            $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
            _WinAPI_DeleteObject($hBmp)
            $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
            _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
            _GDIPlus_ImageDispose($hImage)
            _GDIPlus_GraphicsDispose($hGraphic)
            $hImage = _GDIPlus_BitmapCloneArea($hBitmap, 0, 0, $iW, $iH, $GDIP_PXF32ARGB)
            _GDIPlus_BitmapDispose($hBitmap)
        EndIf
    EndIf
    ;=> End Work around

    $tBitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $iW, $iH, $GDIP_ILMWRITE, $GDIP_PXF32ARGB)
    $iStride = DllStructGetData($tBitmapData, "stride")
    $iScan0 = DllStructGetData($tBitmapData, "Scan0")
    $tPixelData = DllStructCreate("dword[" & (Abs($iStride * $iH)) & "]", $iScan0)
    $bytecode = "0x8B7424048B4C24088B0638E0750EC1E80838E0750783C604E2EE31C0C3"
    $tCodeBuffer = DllStructCreate("byte[" & StringLen($bytecode) / 2 - 1 & "]") ;alloc some memory
    DllStructSetData($tCodeBuffer, 1, $bytecode) ;write bytecode into struct
    $sRet = DllCall("user32.dll", "ptr", "CallWindowProcW", "ptr", DllStructGetPtr($tCodeBuffer), "ptr", DllStructGetPtr($tPixelData), "int", $iW * $iH, "int", 0, "int", 0);returns eax in ret[0]

    _GDIPlus_BitmapUnlockBits($hImage, $tBitmapData)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()
    Return ($sRet[0] = 0)
EndFunc   ;==>_IsImageGrayScale
Edited by MRXTO09
Posted

Please read the Forum Rules, Specially this part:

 

  Quote

1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects:

....

Launching, automation or script interaction with games or game servers, regardless of the game.

...

 

Posted

I don't think it's related to games only. Taking screenshots isn't automating any way the game and in my opinion it's not against the rules, but who knows. Moderators will decide :)

Anyways:

MRXTO09 - I can't really understand what's the question? Do you want to bypass the limitation and make a screenshot even if such software is running? Or you just want to detect if the screenshot failed?(since you told the second, but it doesn't seem to be logical).

Posted
  On 4/10/2014 at 5:16 PM, Unc3nZureD said:

I don't think it's related to games only. Taking screenshots isn't automating any way the game and in my opinion it's not against the rules, but who knows. Moderators will decide :)

Anyways:

MRXTO09 - I can't really understand what's the question? Do you want to bypass the limitation and make a screenshot even if such software is running? Or you just want to detect if the screenshot failed?(since you told the second, but it doesn't seem to be logical).

 

  On 4/10/2014 at 5:01 PM, Palestinian said:

Please read the Forum Rules, Specially this part:

 

you have misunderstood! I wanted to do a program like fraps to take screenshots and if he saw a screenshot black not save it. here as

  • Moderators
Posted

MRXTO09,

  Quote

I wanted to do a program like fraps to take screenshots

Are these screenshots specifically of the game window as a record of its current state? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

MRXTO09,

Then that counts as "game interaction" - thread locked. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...