|
|
差不多一个多星期了。
看了那么多篇文章,代码都有问题,找来的代码写到程序里都不能运行,也不知道是不是我长的太难看的原因。
弄了这么久,用VB和C++都是只能让程序全屏。
也就是说,设置协作模式,然后设置显示模式,
然后到了DDSPrimary就卡住了。
我自己胡写了一个,肯定问题很大,帮忙纠正一下
让我先打出来个Hello World,不然我真的没学劲了!
Option Explicit
Dim DX As New DirectX7
Dim DD As DirectDraw7
Dim DDSPrimary As DirectDrawSurface7
Dim ddsd As DDSURFACEDESC2
Private Sub Form_Load()
Set DD = DX.DirectDrawCreate("")
DD.SetCooperativeLevel Me.hWnd, DDSCL_EXCLUSIVE Or DDSCL_FULLSCREEN
DD.SetDisplayMode 1280, 1024, 16, 0, DDSDM_DEFAULT
ddsd.lFlags = DDSD_CAPS
ddsd.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
ddsd.lWidth = 100
ddsd.lHeight = 100
Set DDSPrimary = DD.CreateSurface(ddsd)
DDSPrimary.SetFontBackColor RGB(255, 255, 255)
DDSPrimary.SetForeColor RGB(0, 0, 0)
DDSPrimary.DrawLine 100, 100, 200, 200
DDSPrimary.DrawText 100, 100, "Hello World", True
End Sub
|
|