Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm having a issue on a project;I'm wanting to create a 3D image using directX 8 but I can't create the image because it throws out a exception :
<pre lang="text">argumentnullException the argument of D3D.createDevice 's last parameter was null.

My code:

What I have tried:

<pre lang="VB">
Imports System
imports system.drawing
imports system.data
imports system.collections.generic
imports system.windows.forms
imports Microsoft.direct4XVB.directX8
public class cellular
inherits Forms
Dim Dx8 As DirectX8
Dim D3D As Direct3D8
Dim app As Object = createObject("app")
Dim Device As Direct3Ddevice8
Dim apprunning As Boolean
Public Function init() As boolean
 On Error goto  errHdl:
  Dim Dispmode As D3Ddisplaymode,_
  Dwindow As D3Dpresent_parameters 
  Dx8=new DirectX8()
  D3D = Dx8.Direct3Dcreate()
  'the rest of the code isn't important reply 1209 to view it
  'the code where the problem Revolves 
  D3Ddevice = D3D.createDevice(D3Dadapter_default,D3Dedevtype_hal,D3Dcreate_software_vertexprocessing,D3Dwindow)
  init()=true
  Exit Function
  errhdl:
    init()=false
 End Function
End Class
Posted

1 solution

First off, stop using On Error - use the more modern Try ... Catch instead.

Then look at the definition of the function:
IDirect3D9::CreateDevice (d3d9.h) - Win32 apps | Microsoft Learn[^]
Or the MS tutorial:
IDirect3D9::CreateDevice (d3d9.h) - Win32 apps | Microsoft Learn[^]
It requires 6 parameters, and you supply only 4 ...
 
Share this answer
 
Comments
CPallini 15-Jan-24 2:12am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900