小弟我想学习一个代码,但是出有关问题,请大家指点一上
我想学习一个代码,但是出问题,请大家指点一下
以下是很早的有关directx的开发例子,代码如下,但是运行出现错误,提示:编译错误,找不到工程或库,大家自己拷贝代码之后运行一下看看,vb6的,请高手指点一下我应该如何处理?
-------------------------------------------
' DirectDraw Starfield Sample, Copyright Patrice Scribe, 1997
Option Compare Text
Option Explicit
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Const NumberOfStars = 400 ' Number of stars
Const ResolutionX = 320 ' Width for the display mode
Const ResolutionY = 200 ' Height for the display mode
Dim dd As DirectDraw2 ' DirectDraw object //////////////////////就这里开始出现错误了!!!
Dim ddsdFront As DDSURFACEDESC ' Front surface description
Dim ddsFront As DirectDrawSurface2 ' Front buffer
Dim ddsBack As DirectDrawSurface2 ' Back buffer
Dim ddCaps As DDSCAPS ' Capabilities for search
Dim lhdc As Long ' hDC for back buffer
Dim i As Long
Dim fx As DDBLTFX
Dim blnEnd As Boolean
Private Type TStar
x As Single ' x !
y As Single ' y !
Color As Byte ' Color (intensity)
End Type
Dim aStars(1 To NumberOfStars) As TStar
Private Sub Form_Load()
' Initial stars
Dim i As Long
For i = 1 To NumberOfStars
With aStars(i)
.x = Rnd * ResolutionX \ 2 - ResolutionX \ 4
.y = Rnd * ResolutionY \ 2 - ResolutionY \ 4
.Color = Rnd * 20 + 50
End With
Next
' Create the DirectDraw object
DirectDrawCreate ByVal 0&, dd, Nothing
' This app is full screen and will change the display mode
dd.SetCooperativeLevel Me.hWnd, DDSCL_EXCLUSIVE Or DDSCL_FULLSCREEN
' Set the display mode
dd.SetDisplayMode ResolutionX, ResolutionY, 8, 0, 0
以下是很早的有关directx的开发例子,代码如下,但是运行出现错误,提示:编译错误,找不到工程或库,大家自己拷贝代码之后运行一下看看,vb6的,请高手指点一下我应该如何处理?
-------------------------------------------
' DirectDraw Starfield Sample, Copyright Patrice Scribe, 1997
Option Compare Text
Option Explicit
Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Const NumberOfStars = 400 ' Number of stars
Const ResolutionX = 320 ' Width for the display mode
Const ResolutionY = 200 ' Height for the display mode
Dim dd As DirectDraw2 ' DirectDraw object //////////////////////就这里开始出现错误了!!!
Dim ddsdFront As DDSURFACEDESC ' Front surface description
Dim ddsFront As DirectDrawSurface2 ' Front buffer
Dim ddsBack As DirectDrawSurface2 ' Back buffer
Dim ddCaps As DDSCAPS ' Capabilities for search
Dim lhdc As Long ' hDC for back buffer
Dim i As Long
Dim fx As DDBLTFX
Dim blnEnd As Boolean
Private Type TStar
x As Single ' x !
y As Single ' y !
Color As Byte ' Color (intensity)
End Type
Dim aStars(1 To NumberOfStars) As TStar
Private Sub Form_Load()
' Initial stars
Dim i As Long
For i = 1 To NumberOfStars
With aStars(i)
.x = Rnd * ResolutionX \ 2 - ResolutionX \ 4
.y = Rnd * ResolutionY \ 2 - ResolutionY \ 4
.Color = Rnd * 20 + 50
End With
Next
' Create the DirectDraw object
DirectDrawCreate ByVal 0&, dd, Nothing
' This app is full screen and will change the display mode
dd.SetCooperativeLevel Me.hWnd, DDSCL_EXCLUSIVE Or DDSCL_FULLSCREEN
' Set the display mode
dd.SetDisplayMode ResolutionX, ResolutionY, 8, 0, 0