I am attempting to use memory DCs in a game I am writting, but all the DC ever contains is blank. Heres my code:

VB Code:
  1. Public Function GenerateDC(FileName As String) As Long
  2.  Dim DC&, hBitmap&
  3.  
  4.  'Create a Device Context, compatible with the screen
  5.  DC = CreateCompatibleDC(0)
  6.  
  7.  If DC < 1 Then 'Check for errors, if there was one, exit the function
  8.   GenerateDC = 0
  9.   Exit Function
  10.  End If
  11.  
  12.  'Load the image....
  13.  hBitmap = LoadImage(0, FileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE Or LR_CREATEDIBSECTION)
  14.  
  15.  If hBitmap = 0 Then 'Failure in loading bitmap
  16.   DeleteDC DC
  17.   GenerateDC = 0
  18.   Exit Function
  19.  End If
  20.  
  21.  'Assign the Bitmap to the Device Context
  22.  SelectObject DC, hBitmap
  23.  
  24.  'Return the device context
  25.  GenerateDC = DC
  26.  
  27.  'Delete the bitmap handle object
  28.  DeleteObject hBitmap
  29. End Function
  30.  
  31. Public Function DeleteGeneratedDC(DC As Long) As Long
  32.  If DC > 0 Then 'Check if a vailid DC was sent (greater then 0)
  33.    DeleteGeneratedDC = DeleteDC(DC)
  34.   Else
  35.    DeleteGeneratedDC = 0
  36.  End If
  37. End Function
  38.  
  39. Public Sub LoadGraphics()
  40.  Dim lngCurrDC&, lngTempDC&, strTmpFileN$
  41.  Dim Width&, Height&, FNum%, tmpS$, tmpA$(), X&, Y&
  42.  
  43.  strTmpFileN = GetTemporaryFilename
  44.  FNum = FreeFile
  45.  
  46.  'Cities
  47.  Cities = GenerateDC(AppFolder & GraphicsFolder & "\Cities" & GraphicsExt)
  48.  BitBlt frmMain.Picture1.hdc, 0, 0, 675, 648, Cities, 0, 0, vbSrcCopy
  49.  frmMain.Picture1.Refresh
  50. End Sub