วันศุกร์ที่ 16 มกราคม พ.ศ. 2552

Play Sound In Games With VB.NET





' VB.NET PlaySound Source Code

Option Explicit On
Option Strict On

Public Class Form1

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Integer) As Integer
Private Const SND_ASYNC As Integer = &H1 ' play asynchronously

Dim sFileName As String

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.Escape
End
End Select
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.SizableToolWindow
Me.Text = " Play Sound In Games With VB.NET "
Me.BackColor = Color.Red
Me.KeyPreview = True
BtnPlaySound.Text = " Play Sond "
BtnPlaySound.BackColor = Color.YellowGreen
BtnPlaySound.ForeColor = Color.Blue
sFileName = "D:\Bullet_1.wav"
End Sub

Private Sub BtnPlaySound_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPlaySound.Click
sndPlaySound(sFileName, SND_ASYNC)
End Sub

End Class

' Design VB.NET Source Code Games By Fernando Firaht

ไม่มีความคิดเห็น:

แสดงความคิดเห็น