Chciałbym wykonać screenshot działającego w tle programu OBS Studio (OBS STUDIO to program służy do przechwytywania wideo z innych np gier).

Napisałem taki kod:

Public Class Form1
    Public Structure RECT
        Public left As Int32
        Public top As Int32
        Public right As Int32
        Public bottom As Int32
    End Structure
    Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As IntPtr, ByRef lpRect As RECT) As Int32
    Private Declare Function PrintWindow Lib "User32.dll" (ByVal hWnd As IntPtr, ByVal hdcBlt As IntPtr, ByVal nFlags As Int32) As Int32


    Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
                 (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim destination As IntPtr = FindWindow(Nothing, "OBS 30.0.0 - Profile: Bez tytułu - Sceny: Bez tytułu")
        If destination Then
            ' MsgBox("jest")
            Dim bmp As Bitmap = Capture_hWndToBitmap(destination)
            PictureBox1.Image = bmp

        End If
    End Sub

    Private Function Capture_hWndToBitmap(ByVal WindowHandle As IntPtr) As Bitmap
        Try
            Dim WinRect As RECT
            GetWindowRect(WindowHandle, WinRect)
            Dim bmp As Bitmap = New Bitmap(WinRect.right - WinRect.left, WinRect.bottom - WinRect.top)
            Dim g As Graphics = Graphics.FromImage(bmp)
            Dim hDC As IntPtr = g.GetHdc()
            Dim pwRet As Integer = PrintWindow(WindowHandle, hDC, 0)
            g.ReleaseHdc(hDC)
            If pwRet = 0 Then ' printwindow failed!
                Return Nothing
            Else
                Return bmp
            End If
        Catch
            Return Nothing ' something went wrong!
        End Try
    End Function
End Class

I kod w sumie działa...
Ale screen który otrzymuje - jest częściowo "czarny" a dokładnie miejsce programu OBS Studio, w którym jest przechwytywanie obrazu z gry - to miejsce jest czarne...(może to przez to że jest tam wykorzystywany Directx 11?)
Jest jakiś sposób na wykonanie prawidłowego screena, aby żadne elementy zrzutu ekranu nie były czarne? tylko normalny obraz ?