I've since assigned the device I believe and I'm now receiving this error:
Code:
************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.DirectX.Direct3D.Device..ctor(Int32 adapter, DeviceType deviceType, IntPtr renderWindowHandle, CreateFlags behaviorFlags, PresentParameters[] presentationParameters)
at WindowsApplication2.Screenshot..ctor(Device Device) in C:\Users\Elliot\Desktop\WindowsApplication2\WindowsApplication2\Screenshot.vb:line 15
at WindowsApplication2.Form1.Timer1_Tick(Object sender, EventArgs e) in C:\Users\Elliot\Desktop\WindowsApplication2\WindowsApplication2\Form1.vb:line 107
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Code:
Public dxDevice As Direct3D.Device
Public dxsurface As Surface
Public Sub New(ByVal Device As Direct3D.Device)
dxDevice = New Device(0, DeviceType.Hardware, IntPtr.Zero, CreateFlags.SoftwareVertexProcessing)
dxsurface = dxDevice.CreateOffscreenPlainSurface(1024, 768, Format.A8R8G8B8, Pool.SystemMemory)
dxDevice.GetFrontBufferData(0, dxsurface)
End Sub
Code:
SurfaceLoader.Save(file, ImageFileFormat.Jpg, dxsurface)
dxsurface.Dispose()