I've been working to create a game using visual basic, and using some examples I found on the internet. My problem is that I'm constantly getting a return code of 0 because it doesn't return a handle. The following function is continously returning 0, because of the line in bold. However I'm not sure what it does because the program works fine without it. Can someone help? I want to keep it in if it has a purpose, but it keeps on crashing my program. AHAHAHAHAHA. Thanks. -db
Public Function GenerateDC(FileName As String) As Long
'*******************************************************
'* Function: GenerateDC() As Long
'* Parameters: A file Name
'* Purpose: Gives you back the handle to the file
'*******************************************************
Dim lFileHandle As Long 'The file handle for the file
Dim hBitmap As Long 'The bitmap for the file
'Create a Device Context, compatible with the screen
lFileHandle = CreateCompatibleDC(0)
If lFileHandle < 1 Then
GenerateDC = 0
Exit Function
End If
.
.
.
End Function
Public Function GenerateDC(FileName As String) As Long
'*******************************************************
'* Function: GenerateDC() As Long
'* Parameters: A file Name
'* Purpose: Gives you back the handle to the file
'*******************************************************
Dim lFileHandle As Long 'The file handle for the file
Dim hBitmap As Long 'The bitmap for the file
'Create a Device Context, compatible with the screen
lFileHandle = CreateCompatibleDC(0)
If lFileHandle < 1 Then
GenerateDC = 0
Exit Function
End If
.
.
.
End Function