|
โค้ดสั้นๆง่ายๆในการควบคุมการทำงานของโปรแกรมเปิดเพลงในตำนานอย่าง WinAmp ... ดาวน์โหลดโค้ดชุดเต็ม VB.NET (2010) ได้ที่นี่ ...
ดาวน์โหลด WinAmp ...
มาดูโค้ดกันเถอะ ...
- Public Class frmWinampNet
- Dim waInterface As New wa 'Class wa defined in Class Module wa.vb
- Private Sub btnConnect_Click(sender As System.Object, e As System.EventArgs) Handles btnConnect.Click
- Dim b As Boolean = waInterface.OpenWinamp("C:\Program Files (x86)\Winamp\winamp.exe")
- If b Then
- tsbWinamp.Text = "Status: " & waInterface.waStatus() 'prints "Stopped" or "Playing" or "Paused" if WinAmp already up and in one of those states.
- waInterface.SetVolume(tbVolumn.Value)
- End If
- End Sub
- Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click, btnPause.Click, btnPrev.Click, btnNext.Click
- Dim b As Button = DirectCast(sender, Button)
- Dim L As Long
- With waInterface
- Select Case b.Text
- Case "Play" : L = .waPlay()
- Case "Pause" : L = .waPause()
- Case "Prev" : L = .waPrev()
- Case "Next" : L = .waNext()
- End Select
- End With
- If L <> 0 Then
- tsbWinamp.Text = "Error with " & b.Text & " command"
- Else
- tsbWinamp.Text = "Status: " & waInterface.waStatus()
- End If
- End Sub
- Private Sub tbVolumn_Scroll(sender As System.Object, e As System.EventArgs) Handles tbVolumn.Scroll
- Dim L As Long
- L = waInterface.SetVolume(tbVolumn.Value)
- End Sub
- Private Sub frmWinampNet_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
- Me.tsbWinamp.Text = ""
- End Sub
- Private Sub chkShuffle_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkShuffle.CheckedChanged
- waInterface.TogShuffle()
- End Sub
- End Class
คัดลอกไปที่คลิปบอร์ด
|
|