looking at the source that came with dx7 and im trying to recreate the first the first ddraw tutorial but i keep getting this stupid type mismatch error! i've looked it over pretty good and I can'd find it! I just need a fresh view of it from someone else with a little more experience than dx than me.
Here is the code in the form:
Here is the code in the "setup dx.bas":Code:Private Sub Form_Load() strFile = App.Path & "\picture.bmp" Init End Sub Private Sub Form_Resize() Picture1.Width = Form1.ScaleMode Picture1.Height = Form1.ScaleMode Blt End Sub Private Sub Picture1_Paint() DDraw.RestoreAllSurfaces Init Blt End Sub
Code:Option Explicit 'need this to do anything at all Public DX7 As New DirectX7 'we need this to do anything with ddraw Public DDraw As DirectDraw7 'these are the surfaces we will us with ddraw Public ddsPrimary As DirectDrawSurface7 Public ddsSecondary As DirectDraw7 'these are the descriptions for the ddraw surfaces Public ddsd1 As DDSURFACEDESC2 Public ddsd2 As DDSURFACEDESC2 'this is the clipper so we can draw off the screen Public DDClipper As DirectDrawClipper 'this is just a flag to tell us what we've done Public bInit As Boolean 'this is to hold the path to the picture for out background Public strFile As String Public Sub Init() Set DDraw = DX7.DirectDrawCreate("") Call DDraw.SetCooperativeLevel(Form1.hWnd, DDSCL_NORMAL) 'create the primary surface ddsd1.lFlags = DDSD_CAPS ddsd1.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Set ddsPrimary = DDraw.CreateSurface(ddsd1) 'create the secondary surface ddsd2.lFlags = DDSD_CAPS ddsd2.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN 'the problem is here!!! it says there is a type mismatch! there is not type mismatch!!!! :{ Set ddsSecondary = DDraw.CreateSurfaceFromFile(strFile, ddsd2) Set DDClipper = DDraw.CreateClipper(0) DDClipper.SetHWnd Form1.Picture1.hWnd ddsPrimary.SetClipper DDClipper bInit = True End Sub Public Sub Blt() If bInit = flase Then Exit Sub Dim ddrval As Long Dim rect1 As RECT Dim rect2 As RECT Call DX7.GetWindowRect(Form1.Picture1.hWnd, rect1) rect2.Bottom = ddsd2.lHeight rect2.Right = ddsd2.lWidth ddrval = ddsPrimary.Blt(rect1, ddsSecondary, rect2, DDBLT_WAIT) End Sub
If it helps remember that I'm trying to remake the first tutorial sent with the dx7 sdk.
a fellow programmer,
Drewski




Reply With Quote