can anyone teach me how to correct my code....when I debug this the 12th line or the sndPlaySound("shot.wav", SND_ASYNC) line shows an error "A call to PInvoke function 'StartForm!StartForm.StartForm::sndPlaySound' has unbalanced the stack. This is likely because the managed PInvoke ".Please help me with this one this is a requirement for us to be able to pass the subject...tnx guyz

Public Class StartForm

Declare Function sndPlaySound Lib "winmm.dll " Alias "sndPlaySoundA" (ByVal Name As String, ByVal Flags As Long) As Long
Private Const SND_ASYNC As Int32 = &H1
Private BlnSounds As Boolean = True

Public Sub PictureBox1 _Click(blah blah blah)
On Error GoTo fix
If Start = True Then
            If MenuItem4.Checked = True Then
                sndPlaySound("shot.wav", SND_ASYNC)
            End If
            Bullets = Bullets - 1
            Points = Points + 1
            Label2.Text = "Bullets : " & Bullets
            Label3.Text = "Score : " & Points
            If Bullets = 0 Then
                Start = False
                MenuItem3.Enabled = False
                MsgBox("Bullets over!" & Chr(13) & "Game over!", vbCritical, "Out of bullets!")
            End If
            Me.PictureBox3.BackColor = Color.Red
            Me.PictureBox3.Cursor = Cursors.SizeAll
            If Points = 20 Then
                Start = False
                MenuItem3.Enabled = False
                MsgBox("You exterminated all Gays!!!You won the game!!!")
            End If

        End If
End Sub
End Class
10 Years
Discussion Span
Last Post by Jx_Man
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.