Whats wrong with this code? 
Author Message
 Whats wrong with this code?

Hey, I'm a newby in directx.

As U can see, im still using dx7, for I got a lot of books on this. But now,
starting to code i get some error-message:
I marked the "problem-line"

Can anybody help me? Here is the code:

Option Explicit

'Objekte vorbereiten
Dim DX As New DirectX7
Dim DD As DirectDraw7

'Oberfl?chen vorbereiten
Dim DD_PrimSurf As DirectDrawSurface7
Dim DD_BackSurf As DirectDrawSurface7
Dim DD_3DSurf As DirectDrawSurface7
Dim DD_PitSurf As DirectDrawSurface7

'Oberfl?chenbeschreibungen
Dim SD_Primsurf As DDSURFACEDESC2
Dim SD_BackSurf As DDSURFACEDESC2
Dim SD_3DSurf As DDSURFACEDESC2
Dim SC_PitSurf As DDSURFACEDESC2

'Variablen vorbereiten
Dim bRunning As Boolean

Sub main()

    Form_Intro.Show
    InitD3D
    Gameloop
    ReleaseD3D
End Sub

Sub InitD3D()

    Set DD = DX.DirectDrawCreate("")
    Call DD.SetCooperativeLevel(Form_Intro.hWnd, DDSCL_FULLSCREEN Or
DDSCL_EXCLUSIVE Or DDSCL_ALLOWREBOOT)
    DD.SetDisplayMode 800, 600, 16, 0, DDSDM_DEFAULT

    With SD_Primsurf
        .lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
        .ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_COMPLEX Or
DDSCAPS_FLIP
        .lBackBufferCount = 1
    End With
    Set DD_PrimSurf = DD.CreateSurface(SD_Primsurf)

    With SD_BackSurf
        .lFlags = DDSD_CAPS
        .ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
    End With
    Set DD_BackSurf = DD_PrimSurf.GetAttachedSurface(SD_BackSurf) '
!!!!!!!!!!!!!!!!!That's where the problem is!!!!!!!!!!!!!!!!!!!!!!!

    'the msgbox says: "Fehler beim Kompilieren: Argumenttyp byref
unvertr?glich".
    'I am not able to properly translate this, but roughly spoken it should
say: Error while compilating: wrong type of argument byref"

End Sub

Sub Gameloop()

    Do

    Loop While bRunning

End Sub

Sub ReleaseD3D()

    DD.RestoreDisplayMode

    Set DD_PrimSurf = Nothing
    Set DD_BackSurf = Nothing
    Set DD_PitSurf = Nothing
    Set DD_3DSurf = Nothing

    Set DD = Nothing
    Set DX = Nothing

    End

End Sub



Sat, 09 Oct 2004 04:23:04 GMT  
 Whats wrong with this code?
what is the value of DD_PrimSurf?

what is the value of SD_BackSurf?

is there a return code indicating the error:

what does the debug runtime say?

does the REF device operate the same?

--
Phil Taylor
PM : DirectX SDK, Managed DirectX, WindowsXP Inbox 3D Screensavers, and a
few more bits and bobs
http://msdn.microsoft.com/directx
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:

> Hey, I'm a newby in directx.

> As U can see, im still using dx7, for I got a lot of books on this. But
now,
> starting to code i get some error-message:
> I marked the "problem-line"

> Can anybody help me? Here is the code:

> Option Explicit

> 'Objekte vorbereiten
> Dim DX As New DirectX7
> Dim DD As DirectDraw7

> 'Oberfl?chen vorbereiten
> Dim DD_PrimSurf As DirectDrawSurface7
> Dim DD_BackSurf As DirectDrawSurface7
> Dim DD_3DSurf As DirectDrawSurface7
> Dim DD_PitSurf As DirectDrawSurface7

> 'Oberfl?chenbeschreibungen
> Dim SD_Primsurf As DDSURFACEDESC2
> Dim SD_BackSurf As DDSURFACEDESC2
> Dim SD_3DSurf As DDSURFACEDESC2
> Dim SC_PitSurf As DDSURFACEDESC2

> 'Variablen vorbereiten
> Dim bRunning As Boolean

> Sub main()

>     Form_Intro.Show
>     InitD3D
>     Gameloop
>     ReleaseD3D
> End Sub

> Sub InitD3D()

>     Set DD = DX.DirectDrawCreate("")
>     Call DD.SetCooperativeLevel(Form_Intro.hWnd, DDSCL_FULLSCREEN Or
> DDSCL_EXCLUSIVE Or DDSCL_ALLOWREBOOT)
>     DD.SetDisplayMode 800, 600, 16, 0, DDSDM_DEFAULT

>     With SD_Primsurf
>         .lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
>         .ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_COMPLEX Or
> DDSCAPS_FLIP
>         .lBackBufferCount = 1
>     End With
>     Set DD_PrimSurf = DD.CreateSurface(SD_Primsurf)

>     With SD_BackSurf
>         .lFlags = DDSD_CAPS
>         .ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
>     End With
>     Set DD_BackSurf = DD_PrimSurf.GetAttachedSurface(SD_BackSurf) '
> !!!!!!!!!!!!!!!!!That's where the problem is!!!!!!!!!!!!!!!!!!!!!!!

>     'the msgbox says: "Fehler beim Kompilieren: Argumenttyp byref
> unvertr?glich".
>     'I am not able to properly translate this, but roughly spoken it
should
> say: Error while compilating: wrong type of argument byref"

> End Sub

> Sub Gameloop()

>     Do

>     Loop While bRunning

> End Sub

> Sub ReleaseD3D()

>     DD.RestoreDisplayMode

>     Set DD_PrimSurf = Nothing
>     Set DD_BackSurf = Nothing
>     Set DD_PitSurf = Nothing
>     Set DD_3DSurf = Nothing

>     Set DD = Nothing
>     Set DX = Nothing

>     End

> End Sub



Sat, 09 Oct 2004 08:18:24 GMT  
 Whats wrong with this code?
you do NOT use a DDSURFACEDESC2 for a backbuffer or Attached surface:

Dim BackSurfDESC as DDSCAPS2
BackSurfDESC.lCaps = DDSCAPS_BACKBUFFER
Set BackBuffer = PrimarySurf.GetAttachedSurface(BackSurfDESC)


Quote:

> Hey, I'm a newby in directx.

> As U can see, im still using dx7, for I got a lot of books on this. But
now,
> starting to code i get some error-message:
> I marked the "problem-line"

> Can anybody help me? Here is the code:

> Option Explicit

> 'Objekte vorbereiten
> Dim DX As New DirectX7
> Dim DD As DirectDraw7

> 'Oberfl?chen vorbereiten
> Dim DD_PrimSurf As DirectDrawSurface7
> Dim DD_BackSurf As DirectDrawSurface7
> Dim DD_3DSurf As DirectDrawSurface7
> Dim DD_PitSurf As DirectDrawSurface7

> 'Oberfl?chenbeschreibungen
> Dim SD_Primsurf As DDSURFACEDESC2
> Dim SD_BackSurf As DDSURFACEDESC2
> Dim SD_3DSurf As DDSURFACEDESC2
> Dim SC_PitSurf As DDSURFACEDESC2

> 'Variablen vorbereiten
> Dim bRunning As Boolean

> Sub main()

>     Form_Intro.Show
>     InitD3D
>     Gameloop
>     ReleaseD3D
> End Sub

> Sub InitD3D()

>     Set DD = DX.DirectDrawCreate("")
>     Call DD.SetCooperativeLevel(Form_Intro.hWnd, DDSCL_FULLSCREEN Or
> DDSCL_EXCLUSIVE Or DDSCL_ALLOWREBOOT)
>     DD.SetDisplayMode 800, 600, 16, 0, DDSDM_DEFAULT

>     With SD_Primsurf
>         .lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
>         .ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_COMPLEX Or
> DDSCAPS_FLIP
>         .lBackBufferCount = 1
>     End With
>     Set DD_PrimSurf = DD.CreateSurface(SD_Primsurf)

>     With SD_BackSurf
>         .lFlags = DDSD_CAPS
>         .ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
>     End With
>     Set DD_BackSurf = DD_PrimSurf.GetAttachedSurface(SD_BackSurf) '
> !!!!!!!!!!!!!!!!!That's where the problem is!!!!!!!!!!!!!!!!!!!!!!!

>     'the msgbox says: "Fehler beim Kompilieren: Argumenttyp byref
> unvertr?glich".
>     'I am not able to properly translate this, but roughly spoken it
should
> say: Error while compilating: wrong type of argument byref"

> End Sub

> Sub Gameloop()

>     Do

>     Loop While bRunning

> End Sub

> Sub ReleaseD3D()

>     DD.RestoreDisplayMode

>     Set DD_PrimSurf = Nothing
>     Set DD_BackSurf = Nothing
>     Set DD_PitSurf = Nothing
>     Set DD_3DSurf = Nothing

>     Set DD = Nothing
>     Set DX = Nothing

>     End

> End Sub



Sun, 10 Oct 2004 13:08:09 GMT  
 Whats wrong with this code?
Hi Andre,

thanks a lot. U got ist!
The problem was using a DDSURFACEDESC2 instead of as DDSCAPS2 with my
attached surface.

now it's running properly.

thanks to Philip as well.

Greetings from {*filter*}space,
Mondspeer



Tue, 12 Oct 2004 05:45:50 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Whats wrong with withis code???

2. Whats Wrong with this CODE!

3. whats wrong with this code?

4. whats wrong in this code snippet?

5. Whats wrong with this code

6. Whats wrong with this code?

7. whats wrong with this code??????

8. Help: Whats wrong with following code??

9. Whats Wrong with this code????

10. Whats wrong with this code

11. Can someone explain whats wrong with this code?

12. whats wrong with this code??????

 

 
Powered by phpBB® Forum Software