Public Sub DirectX_Snapshot(ByVal File_Path As String)
Dim Surface As Direct3DSurface8
Dim SrcPalette As PALETTEENTRY
Dim SrcRect As RECT
Dim Direct3D_Display_Mode As D3DDISPLAYMODE
'get display dimensions
Direct3D_Device.GetDisplayMode Direct3D_Display_Mode
'create a surface to put front buffer on,
'GetFrontBuffer always returns D3DFMT_A8R8G8B8
Set Surface = Direct3D_Device.CreateImageSurface(Direct3D_Display_Mode.Width, Direct3D_Display_Mode.Height, D3DFMT_A8R8G8B8)
'get data from front buffer
Direct3D_Device.GetFrontBuffer Surface
'we are saving entire area of this surface
With SrcRect
.Left = 0
.Right = Direct3D_Display_Mode.Width
.Top = 0
.bottom = Direct3D_Display_Mode.Height
End With
'save this surface to a BMP file
'Direct3DX.SaveSurfaceToFile File_Path, D3DXIFF_BMP, Surface, SrcPalette, SrcRect
'save this surface to a JPG file
Direct3DX.SaveSurfaceToFile File_Path, D3DXIFF_JPG, Surface, SrcPalette, SrcRect
'Here are some more formats
'D3DXIFF_TGA
'D3DXIFF_PNG
'D3DXIFF_DIB
'D3DXIFF_DDS
'D3DXIFF_PPM
'D3DXIFF_FORCE_DWORD <---- Don't know what that does.
End Sub