Need help initializing direct x with VB

rifter1818

Junior Contributor
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
Why doesnt this work? all the variables are set to default however ive tried adjusting the windowed variable neither work can anyone please help me... using managed dx
Visual Basic:
public class dx9
Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Imports System.Windows.Forms
public d3ddevice as device
    Private TargetForm As Form
    Private sWidth As Long
    Private sHeight As Long
    Public Sub Initialize(Optional ByVal windowed As Boolean = False, Optional ByVal ScreenWidth As Long = 1280, Optional ByVal ScreenHeight As Long = 1024, Optional ByVal ColorFormat As Long = 33)
        Dim d3dpp As New PresentParameters
        TargetForm = New Form
        TargetForm.Show()
        TargetForm.Focus()
        d3dpp.Windowed = windowed
        sWidth = ScreenWidth
        sHeight = ScreenHeight
        d3dpp.BackBufferCount = 1
        d3dpp.BackBufferFormat = ColorFormat
        d3dpp.BackBufferHeight = ScreenHeight
        d3dpp.BackBufferWidth = ScreenWidth
        d3dpp.SwapEffect = SwapEffect.Copy
        D3DDevice = New Device(0, DeviceType.Hardware, TargetForm, CreateFlags.SoftwareVertexProcessing, d3dpp)
    End Sub
end class
note that when it errors is allways the last line = new device .....
with the following error:
An unhandled exception of type 'Microsoft.DirectX.Direct3D.InvalidCallException' occurred in microsoft.directx.direct3d.dll

Additional information: Error in the application.
 
k Stupid me

Fixed it for windowed mode

If Not windowed Then
d3dpp.BackBufferCount = 1
d3dpp.BackBufferFormat = ColorFormat
d3dpp.BackBufferHeight = ScreenHeight
d3dpp.BackBufferWidth = ScreenWidth
End If

But i dont really want windowed mode,... how do i get full screen to work?
 
Back
Top