Jump to content

Recommended Posts

Posted

I'm running multiple monitors at different resolutions. When I take a screenshot, the areas that are captured outside of the monitors are automatically colored in black.

Is there a way to change this behavior?

Func TakeScreenshot()
    Local $hBmp, $date, $splitDate, $time, $splitTime
    Local $screenPosition = WinGetPos("[CLASS:Progman]", "")
    Local $minXposition, $minYposition, $screenSizeX, $screenSizeY
    $minXposition = $screenPosition[0]
    $maxYposition = $screenPosition[1]
    $screenSizeX = $screenPosition[2]
    $screenSizeY = $screenPosition[3]
    ;Remove / from date
    $splitDate = StringSplit(_NowDate(), "/")
    $date = $splitDate[1] & $splitDate[2] & $splitDate[3]
    ;Remove : from time
    $splitTime = StringSplit(_NowTime(5), ":")
    $time = $splitTime[1] & $splitTime[2] & $splitTime[3]
    ; Capture all screens, no cursor
    _ScreenCapture_SetBMPFormat(4)
    $hBmp = _ScreenCapture_Capture("", $minXposition, $maxYposition,($screenSizeX + $minXposition), ($screenSizeY + $maxYposition), 0)

    ; Save to file
    _ScreenCapture_SaveImage(@DesktopDir & "\" & $date & " " & $time & ".png", $hBmp)
    _WinAPI_DeleteObject($hBmp)
EndFunc   ;==>TakeScreenshot

*attached image is all white backgrounds to show sample of monitors vs capture*

2132020 102740.png

If you need help with your stuff, feel free to get me on my Skype.

I often get bored and enjoy helping with projects.

Posted

I don't believe there is. But you could use _WinAPI_EnumDisplayDevices to get all monitors size, understand what are the parts that go outside. Use GDI+ to change black color to the color you want.  Save the file.  At least that is what I would be tempted to do...

Posted (edited)

If you are only taking a screenshot of a window, you could use this function that I got from Nine.

please note, this takes a screenshot of ONLY the window handle specified, if you want to see error popups, they won't be shown.

Func _Capture_Window($hWnd, $sTargetFile)
    $aWinPos = WinGetPos($hWnd, "")
    If @error Then Return 0             ;Window was not found

    If ($aWinPos[2] < 0) or ($aWinPos[3] < 0) Then Return 0 ;Window is minimized if width or height is a negative number

    Local $hDC_Capture = _WinAPI_GetDC($hWnd)
    Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture)
    Local $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $aWinPos[2], $aWinPos[3])
    Local $hObject = _WinAPI_SelectObject($hMemDC, $hHBitmap)
    _WinAPI_PrintWindow($hWnd, $hMemDC)
    $bSCsaved = _ScreenCapture_SaveImage($sTargetFile, $hHBitmap)
    _WinAPI_DeleteDC($hMemDC)
    _WinAPI_ReleaseDC($hWnd, $hDC_Capture)
    _WinAPI_DeleteObject($hHBitmap)

    If $bSCsaved Then
        Return $sTargetFile
    Else
        Return 0
    EndIf
EndFunc

 

 

If you just want to change the black section into white, then there are functions to make that change.  I put something out there a while ago that's close.  

 

 

If you only want to take a screenshot of the actual used portion then you would have to take separate screenshots of the multiple screens.

Edited by BigDaddyO
Posted

Thank you for the advice. I thought about taking a screenshot of just the monitors and then stitching everything together... but, lazy

For now, I actually just have all of my black backgrounds set to 0x010101 so it's almost black. It makes it easy to rip out the parts outside of the monitor, if I need to

If you need help with your stuff, feel free to get me on my Skype.

I often get bored and enjoy helping with projects.

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
  • Recently Browsing   0 members

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