Visual Basic Problems Using DirectX 8.0

ok, What I really would like is to download visual basic 6.0, but I cant find anywhere to do that..

My problem with visual Basic express edition, is I cant seem to get my reference to Directx 8 to work, I have reinstalled directx 8 and VB but it still wont work for me, any ideas> I am programming in BASIC and am very new at it...

if anybody could help me I'd be very thankfull, you can contact me by emailing me at Lukeskiwalker@bellsouth.net, or posting here...

Thank you very much,

Wesly



Answer this question

Visual Basic Problems Using DirectX 8.0

  • eman lee

    OK on the following statement

    Dim dx As DxVBLibA.DirectX8

    DxVBLibA.DirectX8 is classed as a fully qualified class name. It comprises of the class DirectX8 and the namespace (DxVBLibA) which contains the class.

    What namespaces allow you to do is have two classes with the same name but contained within different namespaces and use them both.

    Namespaces are used throughout the .Net framework.

    In order to allow you to avoid having to type the namespace everytime you can use the imports statement

    so if you put the following at the top of the file

    Imports DxVBLibA

    what this will do is provide a shortcut to this namespace and allow you to then type

    Dim dx As DirectX8

    as it will know about all the methods contained in the DxVBLiba namespace you have referenced. If there are collisions with Classes that exist in both namespaces then you may still have to use the fully qualified name to differentiate which one to call.


  • codenut

    Well, when I make my reference to directx 8 it acts like I didnt make a reference at all, when I start to type directx 8 it goes to a fall down list that has different Items, but doesnt show directx 8, mabey im doing it wrong, I go to project>add reference>COM>then I goe down the list to directx 7&8 and click on 8 and click add...

    then when I go to my project, and double click on the subject to get to the coding, I start my coding, when I type anything about Directx 8 it says it is "undefined"...  that any Idea


  • Chris Monachan

    Sure directx has chnaged and VB has changed since VB6.

    A book is only as good as the information available at the time and the products its refering to - new versions come along and things change.

    I think you will find that the hWnd method on a form in VB6 is not the Handle method in VB.NET.


  • Ata Demiray

    That was Extremely Helpful. I probably have the same book that Jman has.

    The Imports DxVBLibA did solve most of the reference problems.

    But...

    It did not affect some of the other ones. Like:

    "d3dpp.hDeviceWindow = Me.hWnd

    'at this point it says Error 1 'hWnd' is not a member of 'WindowsApplication1.Form'.

    "

    and:

    d3ddev.Clear 0(Error 6 Method arguments must be enclosed in parentheses.), byval 0 (Error 7 Expression expected.), DxVBLibA.CONST_D3DCLEARFLAGS.D3DCLEAR_TARGET,RGB(255, 0, 0) 1# (Error 8 Comma, ')', or a valid expression continuation expected.), 0

    "ByVal seems to be the source of the error"

    It seems to me that these references and syntax are no longer in use, or have changed since VB 6.0.

    Do you have any idea what the new reference or syntax is


  • Venugopal123

    OK VB6 is not available to download. Its an old product which is probably 8 years old and was replaced with VB.Net 2002,2003 and 2005 It is also a chargeable product, unlike VB Express which is free.

    What is you specific issue with DirectX 8 .

    Directx 8 is a COM component and VB Express will allow you to consume components in the same way that VB6 would have allowed you to consume COM components. COM is based upon an older technology than .NET but VB.Net supports COM.


  • JesterSoftware

    can someone help me i tried to use my old code from VB6 on VB2005 and i realize i have to imports many const from DXVBLIBA just to set some constant value, can it be simplified also some of the procedures doesn't seems to work (cause an error, like : Name 'D3DVertexBuffer8SetData' is not declared. i assump i have to imports or add another references...but i'm not sure cause i can't find any and on VB6, i only need to add reference to DirectX 8

    i followed tutorial given by MSDN and got stuck at a same problem, example :

    Dim matView As D3DMATRIX
    D3DXMatrixLookAtLH matView, vec3(0#, 3#, -5#), _
                  vec3(0#, 0#, 0#), _
                  vec3(0#, 1#, 0#)
                   
    g_D3DDevice.SetTransform D3DTS_VIEW, matView
    

    D3DXMatrixLookAtLH and vec3 also cause error : not defined

    D3DVertexBuffer8SetData(VB, 0, VertexSizeInBytes * 36, 0, Vertices(0))

    please reply asap, thanks


  • PromemoreX

    Yes .hwnd is now .handle


  • prashanthmscis1227

    hmmm... ok so I figured part of it out, before I can get to directx on the fall down list, I have to first type in DxVBLibA.DirectX8, my next question is, what is DxVBLibA, and why must I write it before I can get to directx8

    My next problem is, when I go to finnish my coding, (it looks like this):

    Dim dx As DxVBLibA.DirectX8

    Dim d3d As DxVBLibA.Direct3D8

    Dim d3dpp As DxVBLibA.D3DPRESENT_PARAMETERS

    Dim dispmode As DxVBLibA.D3DDISPLAYMODE

    Dim d3ddev As DxVBLibA.Direct3DDevice8

    Private Sub Form_Load()

    'create the directX object

    dx = New DxVBLibA.DirectX8

    'create the direct3d object

    d3d = dx.Direct3DCreate()

    'set the display device parameters for windowed mode

    d3dpp.hDeviceWindow = Me.hWnd

    'at this point it says Error 1 'hWnd' is not a member of 'WindowsApplication1.Form'.

    d3dpp.BackBufferCount = 1

    d3dpp.BackBufferWidth = 640

    d3dpp.BackBufferHeight = 480

    d3dpp.SwapEffect = DxVBLibA.CONST_D3DSWAPEFFECT.D3DSWAPEFFECT_DISCARD

    d3dpp.Windowed = 1

    d3d.GetAdapterDisplayMode(D3DADAPTER_DEAFAULT, dispmode)

    d3dpp.BackBufferFormat = dispmode.Format

    the errors show D3DADAPTER_DEFAULT, as not "declared",

    'create the Direct3D primary device

    d3ddev = d3d.CreateDevice( _

    D3DADAPTER_DEFAULT, _

    D3DDEVTYPE_HAL, _

    hWnd, _

    DxVBLibA.CONST_D3DCREATEFLAGS.D3DCREATE_SOFTWARE_VERTEXPROCESSING, _

    d3dpp)

    End Sub

    ok I got all kind of problems here:

    Error 3 Name 'D3DADAPTER_DEFAULT' is not declared.

    Error 4 Name 'D3DDEVTYPE_HAL' is not declared.

    Error 5 Name 'hWnd' is not declared.


    Private Sub Form_Paint()

    'clear the window with red color

    d3ddev.Clear 0(Error 6 Method arguments must be enclosed in parentheses.), byval 0 (Error 7 Expression expected.), DxVBLibA.CONST_D3DCLEARFLAGS.D3DCLEAR_TARGET,RGB(255, 0, 0) 1# (Error 8 Comma, ')', or a valid expression continuation expected.), 0

    'refresh the window

    d3ddev.Present ByVal 0, ByVal 0, 0, ByVal 0

    End Sub

    Private Sub Form_QueryUnload(ByVal cancel As Integer, ByVal unloadmode As Integer)

    Shutdown() (Error 13 Name 'Shutdown' is not declared.)

    End Sub

    Private Sub Form_KeyDown(ByVal KeyCode As Integer, ByVal shift As Integer)

    If KeyCode = 27 Then Shutdown()

    End Sub

    Private Sub SubShutdown()

    d3ddev = Nothing

    d3d = Nothing

    dx = Nothing

    End

    End Sub

    If you dont feel like goin thru and tellin me how to fix this I understand, just say so and I'll try figuring it on my own, kinda stumped tho, first time I have ever tried using VB...


  • Miguel Coutinho

    Are you typing the fully qualified typename when your typing them in

    If you added a reference and you havent put an imports statement in then you will have to type a fully qualified typename. If you put in an imports statement then you can shorten down you names by whatever you put in the imports statement.

    You should be able to see the methods for this library in the object browser - do you see the DX methods in the object browser.

    I'm add a reference to DirectX and saw the DX methods in the object browser and could use from VB Express. (Albiet it wasnt DirectX 8 but I would almost certainly think that the version is not the issue).


  • LearnSqlServer.com

    I have fixed most of the problems. except for 2.

    d3ddev.Clear(0, ByVal 0, D#DCLEAR_TARGET, RGB(255,0,0)m 1#,0)

    deddev.Present ByVal 0, ByVal 0, 0,ByVal 0

    ByVal doesn't seem to be used correctly. The Debugger says "Expression Expected"

    The Other is Me.hWnd that doesn't seem to be a valid reference anymore. is this what you were referring to with the handle reference

    -TetsuKaben


  • Elias TMQ Inc

    ill start by typing:

    Private Sub Form_Load()

    Dim directx as directx8

    End Sub

    and directx8 will be underlined and say, statment undefined, which led me to believe that my reference did not work correctly, in the fall down list I do not see directx anywhere and the only Dx value I see is DxVBLibA...

    any ideas this may seem pretty stupid, but im new at this and I appretiate it emensly...


  • Visual Basic Problems Using DirectX 8.0