Problem GetBackBuffer
Hi Everyone!
pls help me for fix my problem
Don't Work Don't Wrok 
pls help me for fix my problem

Code:
Imports Microsoft.DirectX.Direct3D
Imports Microsoft.DirectX
Public Class Form1
Private Const PROCESS_ALL_ACCESS As Long = &H1FFFFF
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Integer, ByRef lpdwProcessId As Integer) As Integer
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Integer
#Region " CaptureScreenshot ... "
Public Shared Function CaptureScreenshot(ByVal Device As Direct3D.Device, ByVal Filename As String, ByVal ImageFormat As Direct3D.ImageFileFormat) As Boolean
Dim Ssurface As Direct3D.Surface
Ssurface = Device.GetBackBuffer(0, 0, Direct3D.BackBufferType.Mono)
Direct3D.SurfaceLoader.Save(Filename, ImageFormat, Ssurface)
Ssurface.Dispose()
Return True
End Function
Public Shared Function CaptureScreenshot(ByVal Device As Direct3D.Device, ByVal Filename As String) As Boolean
Return CaptureScreenshot(Device, Filename, Direct3D.ImageFileFormat.Bmp)
End Function
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim hWnd As Object, processHandle As IntPtr, processId As Integer
hWnd = FindWindow(vbNullString, "Call of Duty 4")
If (hWnd = 0) Then
MsgBox("Call of Duty 4! Not Found!", MsgBoxStyle.OkOnly, "Erorr!")
End
End If
GetWindowThreadProcessId(hWnd, processId)
processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId)
Dim Dev As Direct3D.Device = New Direct3D.Device(processHandle)
CaptureScreenshot(Dev, "c:\Screenshott1.jpg", ImageFileFormat.Jpg)
CloseHandle(processHandle)
End Sub
End Class




What line is highlighted when the code breaks during a debug......
