如何讓智慧型裝置發出聲音

摘要:如何讓智慧型裝置發出聲音

感覺上這個問題詢問的頻率還滿高的,在PDA上面我們怎麼利用程式讓它發出聲音(播放wav檔)呢?這裡我們用呼叫API的方式來做,請參考下面程式碼

Imports System.Runtime.InteropServices

Public Class Form1
    Public Const SND_FILENAME = &H20000
    Public Const SND_SYNC = &H0

    ''宣告方式
     _
    Public Shared Function PlaySound(ByVal lpszName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        PlaySound("\windows\Alarm2.wav", 0, 0)
    End Sub
End Class