Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Visual Basic Programming Code Examples

Visual Basic > Code Snippets Code Examples

Winmm example

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
Winmm example Plays an AVI file 'winmm function examples Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long Private Declare Function mciSendString Lib "winmm.dll" Alias _ "mciSendStringA" (ByVal lpstrCommand As String, _ ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _ ByVal hwndCallback As Long) As Long Public Function SoundCard() As Boolean Dim lng As Long lng = waveOutGetNumDevs() If lng > 0 Then SoundCard = True Exit Function Else SoundCard = False Exit Function End If End Function Public Sub PlayAvi() Dim strAviPath As String Dim strCmdStr As String Dim lngReturnVal As Long strAviPath = "h:\windows\clock.avi" strCmdStr = "play " & strAviPath & " fullscreen " lngReturnVal = mciSendString(strCmdStr, 0&, 0, 0&) End Sub Private Sub Form_Load() MsgBox SoundCard() Call PlayAvi End Sub 'Notes: 'change the "h:\windows\clock.avi" to an AVI file on your system