Click here to Skip to main content
Licence 
First Posted 31 Oct 2006
Views 67,841
Downloads 411
Bookmarked 37 times

iTunes Control Using VB.NET

By Michael_Davies | 28 Nov 2006
Exploring the iTunes interface using VB.

1
1 vote, 14.3%
2
2 votes, 28.6%
3
2 votes, 28.6%
4
2 votes, 28.6%
5
3.40/5 - 7 votes
μ 3.40, σa 1.95 [?]

Introduction

Long have I searched for an article on using iTunes through VB; there are many examples in C flavours, even Java, but few using VB. The iTunes SDK details what is available, but has little on usage.

Background

iTunes is a wonderful player, relatively uncomplicated in its use, no adverts or unnecessary gadget like interfaces. I had several reasons for exploring the use of my own interface to it main one being I have an iPod, and want to get information off it and back to the PC. The drive for writing this code was the annoying habit iTunes has of drag and drop of playlists, fine if you are using a mouse as you have to hold down the mouse but I was writing an application that uses a touch screen and drag and drop plays havoc with the playlists. As a result the playlists and tracklists on the form of this application are quite large to make nice landing zones for fingers.

Using the code

You do not need the iTunes SDK to access iTunes, it just helps to start to locate what you want, though I have found that some features are not exposed in the IDE. Also, some of the types do not expose either, which is frustrating as you have to remember to press Escape to prevent the nearest name, usually a collection of the same type, being filled in by the IDE. For example, typing Dim objPlayList as iTunesLib.IITPlayList will produce Dim objPlayList as iTunesLib.IITPlayListCollection, as IITPlayList is not exposed.

To use the code, you must have iTunes installed and add a reference to your project of the COM interface "iTunes  x.x Type Library" where x.x is the version installed with the iTunes version; mine was version 1.8 with version 7.0.1.8 of iTunes, and the COM interface ITDetector.

One item I can not get to work is the iTunes events, running it through the debugger shows that the event subroutines get fired but do not entirely execute for some reason; complete mystery, and if anyone solves, it I would be interested.

Points of Interest

Whilst I enjoyed solving the problem, the lack of documentation and very few examples I could find on the subject for VB did make it frustrating, which is why I decided to share this code. Good Luck.

History

Updated version. Added Try blocks for the iTunes application.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Michael_Davies



United Kingdom United Kingdom

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralInterop.iTunesLib.dll Pinmembersumedhaswamy16:39 2 Sep '10  
GeneralRe: Interop.iTunesLib.dll PinmemberMichael_Davies22:34 2 Sep '10  
GeneralGetting the Track Name to update itself PinmemberI, the Deceiver21:09 27 Aug '10  
GeneralListing all songs Pinmemberehrenberg13:05 15 Jun '10  
GeneralRe: Listing all songs PinmemberMichael_Davies9:01 16 Jun '10  
GeneralRe: Listing all songs Pinmemberehrenberg7:22 17 Jun '10  
GeneralMy vote of 2 PinmvpDave Kreskowiak19:17 28 Aug '09  
GeneralRe: My vote of 2 PinmemberMichael_Davies8:54 16 Jun '10  
GeneralClosing iTunes Window Pinmembersvalerio5:00 4 Jun '08  
GeneralRe: Closing iTunes Window PinmemberMichael_Davies0:39 5 Jun '08  
GeneralRe: Closing iTunes Window PinmemberMichael_Davies0:54 5 Jun '08  
QuestionPlaying specific songs Pinmemberpftburger12:55 8 Oct '07  
AnswerRe: Playing specific songs PinmemberMichael_Davies4:18 9 Oct '07  
GeneralRe: Playing specific songs Pinmemberpftburger4:31 9 Oct '07  
GeneralRe: Playing specific songs PinmemberJoeRip19:13 10 Nov '07  
Generalnice PinmemberTollyver22:25 9 Apr '07  
GeneralRe: nice PinmemberMichael_Davies4:42 13 Apr '07  
GeneralNice! PinmemberLeonardo Paneque16:55 29 Nov '06  
GeneralRe: Nice! Pinmembercrossreferance1:35 3 Feb '07  
GeneralRe: Nice! PinmemberMichael_Davies4:39 13 Apr '07  
GeneralITDETECTORLib Pinmembersheepy8989:38 26 Nov '06  
GeneralRe: ITDETECTORLib [modified] PinmemberMichael_Davies22:44 26 Nov '06  
GeneralRe: ITDETECTORLib Pinmembersheepy89819:17 17 Dec '06  
GeneralRe: ITDETECTORLib PinmemberMichael_Davies22:25 17 Dec '06  
GeneralNullRef Pinmemberchrisr014:50 21 Nov '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120210.1 | Last Updated 28 Nov 2006
Article Copyright 2006 by Michael_Davies
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid