I seen a lot of people ask for Direct X help, well here is some code i found on this site. This is part 1 of part 2 since these posts cant be too long. Sticka bitmap file and a sound file in the project directory, change their names (see code) and read all the annotation (writing in the code).

'-----------------------------------------------------------------
'
'DX8 INTRODUCTION - DIRECTGRAPHICS,DIREC ' TSOUND, DIRECTINPUT
'
' BY SIMON PRICE
'
'--------------------------------------- ' --------------------------

' For this tutorial program you will nee ' d the DirectX8 for Visual
' Basic Type Library, from www.microsoft ' .com/directx

' You should also have the tutorial in H ' TML format, if you don't
' you can download it from my website ww ' w.VBgames.co.uk

' Any questions go to ihaveaquestionfors ' [email protected],
' or you could use a shorter address ' ([email protected] will do)
' Any bug reports go to the same address ' too please, as do comments
' feedback, suggestions, erm whatever yo ' u feel like

' Every time you start a project which w ' ill use DirectX8, you need
' to click on the menu Project -> Refere ' nces and a dialog box will
' pop up. Check the box which says "Dire ' ctX8 for Visual Basic Type
' Library" and click OK. Now VB will kno ' w all the types, classes
' enumerations and functions of DirectX8 ' .

Option Explicit

' GLOBAL VARIABLE DECLARATIONS

' No matter what you do with DirectX8, y ' ou will need to start with
' the DirectX8 object. You will need to ' create a new instance of
' the object, using the New keyword, rat ' her than just getting a
' pointer to it, since there's nowhere t ' o get a pointer from yet (duh!).

Dim DX As New DirectX8

' The DirectInput8 object is used to get data from input devices
' such as the mouse and keyboard. This i ' s what we will use it for
' in this tutorial, since they are the m ' ost common input devices.
' Notice how we don't create a new insta ' nce of the object, rather
' DirectX does that for us and we just g ' et a pointer to it.

Dim DI As DirectInput8

' Now we need 2 devices - keyboard and mouse...

Dim Keyboard As DirectInputDevice8
Dim Mouse As DirectInputDevice8

' ...and a structure (type) to hold the data from each device. DI
' provides us a custom keyboard and mous ' e type, since they are
' commonly used

Dim KeyboardState As DIKEYBOARDSTATE
Dim MouseState As DIMOUSESTATE

' Next, we have DirectSound8, this can be used for many things, but
' for now we just play a sound from a .w ' av file

Dim DS As DirectSound8

' A sound buffer is a piece of memory in which the sound is stored.
' We use a secondary buffer, because a p ' rimary buffer can actually
' be heard though the speakers, and the ' sound needs to be mixed
' before we allow the user to hear that. ' In this tutorial, we let
' DirectSound worry about mixing and cop ' ying to the primary buffer
' to play the sound for us

Dim Sound As DirectSoundSecondaryBuffer8

' The DSBUFFER type holds a description of a sound buffer. We won't
' use any of the more advanced flags in ' this tutorial

Dim SoundDesc As DSBUFFERDESC

' The Direct3D8 object is responsible for all graphics, yes, even 2D

Dim D3D As Direct3D8

' The D3DX8 object contains lots of helper functions, mostly math
' to make Direct3D alot easier to use. N ' otice we create a new
' instance of the object using the New k ' eyword.

Dim D3DX As New D3DX8

' The Direct3DDevice8 represents our rendering device, which could
' be a hardware or a software device. Th ' e great thing is we still
' use the same object no matter what it ' is

Dim D3Ddevice As Direct3DDevice8

' The D3DPRESENT_PARAMETERS type holds a description of the way
' in which DirectX will display it's ren ' dering

Dim D3Dpp As D3DPRESENT_PARAMETERS

' The D3DMATERIAL8 type stores information on the material our
' polygons are rendered with, such as co ' lor

Dim Material As D3DMATERIAL8

' The Direct3DTexture8 object represents a piece of memory used to
' store a texture to be mapped onto our ' polygons

Dim Texture As Direct3DTexture8

' The Direct3DVertexBuffer8 object stores an array of vertices from which
' our polygons are made

Dim VertexBuffer As Direct3DVertexBuffer8

' The D3DVERTEX type stores vertices temporarily before we copy
' them into the vertex buffer

Dim Vertex(1 To 24) As D3DVERTEX

' The Direct3DIndexBuffer8 object stores the order in which our
' vertices are rendered

Dim IndexBuffer As Direct3DIndexBuffer8

' These integers are used to temporarily store indices before they
' are copied into the index buffer

Dim Index(1 To 36) As Integer

' This stores the rotation of the cubes

Dim Rotation As Single






' FORM_LOAD

' The whole program is started and contr ' olled from here

Private Sub Form_Load()

On Error Resume Next
' initialize directx
If Init = False Then
' display error message
MsgBox "Error! Could not initialize DirectX!"
Else
' show form
Show
' do main program loop
MainLoop
End If
' unload form and clean up directx
Unload Me
End Sub



' FORM_UNLOAD

' Before the program ends, call the clea ' nup function

Private Sub Form_Unload(Cancel As Integer)

CleanUp
End Sub






' INITIALIZATION

' In this function we initialize all the ' global DirectX objects. We
' basically get the DirectInput, DirectS ' ound, and DirectGraphics
' engines started up, and retrieve point ' ers so we can manipulate them

Function Init() As Boolean


'On Error GoTo InitFailed

' DIRECTINPUT

' Get a pointer to DirectInput
Set DI = DX.DirectInputCreate()
' Check to see if the pointer is valid
If DI Is Nothing Then GoTo InitFailed

' Get a pointer to keyboard and mouse device objects
Set Keyboard = DI.CreateDevice("GUID_SysKeyboard")
Set Mouse = DI.CreateDevice("guid_SysMouse")
' Check to see if pointers are valid
If Keyboard Is Nothing Then GoTo InitFailed
If Mouse Is Nothing Then GoTo InitFailed

' Set the data formats to the commmonly used keyboard and mouse
Keyboard.SetCommonDataFormat DIFORMAT_KEYBOARD
Mouse.SetCommonDataFormat DIFORMAT_MOUSE

' Although DirectInput provides a default setting, you should still explicitly set the cooperative level because this is the only way to give DirectInput the window handle
' Set cooperative level, this tells DI how much control we need
Keyboard.SetCooperativeLevel hWnd, DISCL_NONEXCLUSIVE Or DISCL_BACKGROUND
Mouse.SetCooperativeLevel hWnd, DISCL_NONEXCLUSIVE Or DISCL_BACKGROUND

' Now we are ready to aquire (erm, get) our input devices
Keyboard.Acquire
Mouse.Acquire

' DIRECTSOUND

' Get a pointer to DirectSound
Set DS = DX.DirectSoundCreate("")
' Check the pointer is valid
If DS Is Nothing Then GoTo InitFailed

' Set cooperative level, we only need normal functionality
DS.SetCooperativeLevel hWnd, DSSCL_NORMAL

' Create a sound buffer from a .wav file. We provide a filename
' and a DSBUFFER type, which stores any special information
' about the buffer we might need to know (not used here)
Set Sound = DS.CreateSoundBufferFromFile(App.Path & "\sound.wav", SoundDesc)
' Check the pointer is valid
If Sound Is Nothing Then GoTo InitFailed

' DIRECT3D

' Get a pointer to Direct3D
Set D3D = DX.Direct3DCreate()
' Check the pointer is valid
If D3D Is Nothing Then GoTo InitFailed

' Fill the D3DPRESENT_PARAMETERS type, describing how DirectX should
' display it's renders

With D3Dpp
' set the most common fullscreen display mode
.Windowed = False ' the app is not in a window
.BackBufferWidth = 1600 ' the size of the screen
.BackBufferHeight = 1200
.BackBufferFormat = D3DFMT_R5G6B5 ' the color depth format (16 bit)
' the swap effect determines how the graphics get from
' the backbuffer to the screen - note : D3DSWAPEFFECT_DISCARD
' means that every time the render is presented, the backbuffer
' image is destroyed, so everything must be rendered again
.SwapEffect = D3DSWAPEFFECT_DISCARD
' request a 16 bit z-buffer - this depth sorts the scene
' so we can't see polygons that are behind other polygons
.EnableAutoDepthStencil = 1
.AutoDepthStencilFormat = D3DFMT_D16
' 1 backbuffer
.BackBufferCount = 1
End With

' Create the rendering device. Here we request a hardware rasterization.
' If your computer does not have this, the request may fail, so use
' D3DDEVTYPE_REF instead of D3DDEVTYPE_HAL if this happens. A real
' program would be able to detect an error and automatically switch device.
' We also request software vertex processing, which means the CPU has to
' transform and light our geometry
Set D3Ddevice = D3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3Dpp)
' check the pointer is valid