Advertisement
botdotdot

Controlling iTunes

Aug 19th, 2011
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.15 KB | None | 0 0
  1. 'NB: You MUST add a COM reference to iTunes
  2.  
  3. Public Class Form1
  4.  
  5.     Private itunesControl As New iTunesLib.iTunesApp
  6.  
  7.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.         TitleLabel.Text = itunesControl.CurrentTrack.Name
  9.         ArtistLabel.Text = itunesControl.CurrentTrack.Artist
  10.         AlbumLabel.Text = itunesControl.CurrentTrack.Album
  11.         VolumeNumericUpDown.Value = itunesControl.SoundVolume
  12.     End Sub
  13.  
  14.     Private Sub PreviousButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PreviousButton.Click
  15.         itunesControl.PreviousTrack()
  16.     End Sub
  17.  
  18.     Private Sub PlayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayButton.Click
  19.         itunesControl.Play()
  20.     End Sub
  21.  
  22.     Private Sub NextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextButton.Click
  23.         itunesControl.NextTrack()
  24.     End Sub
  25.  
  26.     Private Sub PauseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PauseButton.Click
  27.         itunesControl.Pause()
  28.     End Sub
  29.  
  30.     Private Sub StopButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StopButton.Click
  31.         itunesControl.Stop()
  32.     End Sub
  33.  
  34.     Private Sub RewindButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RewindButton.Click
  35.         itunesControl.Rewind()
  36.     End Sub
  37.  
  38.     Private Sub FFButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FFButton.Click
  39.         itunesControl.FastForward()
  40.     End Sub
  41.  
  42.     Private Sub ShuffleButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShuffleButton.Click
  43.         itunesControl.CurrentPlaylist.Shuffle = True
  44.     End Sub
  45.  
  46.     Private Sub RepeatOneButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RepeatOneButton.Click
  47.         itunesControl.CurrentPlaylist.SongRepeat = iTunesLib.ITPlaylistRepeatMode.ITPlaylistRepeatModeOne
  48.     End Sub
  49.  
  50.     Private Sub RepeatAllButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RepeatAllButton.Click
  51.         itunesControl.CurrentPlaylist.SongRepeat = iTunesLib.ITPlaylistRepeatMode.ITPlaylistRepeatModeAll
  52.     End Sub
  53.  
  54.     Private Sub ShuffleNoButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShuffleNoButton.Click
  55.         itunesControl.CurrentPlaylist.Shuffle = False
  56.     End Sub
  57.  
  58.     Private Sub RepeatNoButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RepeatNoButton.Click
  59.         itunesControl.CurrentPlaylist.SongRepeat = iTunesLib.ITPlaylistRepeatMode.ITPlaylistRepeatModeOff
  60.     End Sub
  61.  
  62.     Private Sub MuteButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MuteButton.Click
  63.         itunesControl.Mute = True
  64.     End Sub
  65.  
  66.     Private Sub VolumeNumericUpDown_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VolumeNumericUpDown.ValueChanged
  67.         itunesControl.SoundVolume = VolumeNumericUpDown.Value
  68.     End Sub
  69. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement