Option Explicit
Dim dx As New DirectX7
Dim dd As DirectDraw7
Dim rcRect As RECT
Dim ddsd1 As DDSURFACEDESC2
Dim ddsd2 As DDSURFACEDESC2
Dim Primary As DirectDrawSurface7
Dim Back As DirectDrawSurface7
Dim BackPic As DirectDrawSurface7
Private Sub Form_Load()
Dim bLoop As Boolean
Set dd = dx.DirectDrawCreate("")
Me.Show
Call dd.SetCooperativeLevel(Me.hWnd, DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE)
Call dd.SetDisplayMode(640, 480, 16, 0, DDSDM_DEFAULT)
ddsd1.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
ddsd1.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE Or DDSCAPS_FLIP Or DDSCAPS_COMPLEX
ddsd1.lBackBufferCount = 1
Set Primary = dd.CreateSurface(ddsd1)
Dim caps As DDSCAPS2
caps.lCaps = DDSCAPS_BACKBUFFER
Set Back = Primary.GetAttachedSurface(caps)
ddsd2.lFlags = DDSD_CAPS
ddsd2.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
ddsd2.lHeight = 480
ddsd2.lWidth = 640
Set BackPic = dd.CreateSurfaceFromFile("Back.bmp", ddsd2)
rcRect.Left = 0
rcRect.Top = 0
rcRect.Right = 640
rcRect.Bottom = 480
bLoop = True
Do While bLoop
Back.BltFast 0, 0, BackPic, rcRect, DDBLTFAST_NOCOLORKEY Or DDBLTFAST_WAIT
Primary.Flip Nothing, DDFLIP_WAIT
DoEvents
Loop
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
Set BackPic = Nothing
Set Back = Nothing
Set Primary = Nothing
Call dd.RestoreDisplayMode
Call dd.SetCooperativeLevel(Me.hWnd, DDSCL_NORMAL)
End
End If
End Sub
Сейчас этот форум просматривают: SemrushBot и гости: 166