Kokkei Mizu

Hey there.

I am writing a program that includes showing the current playing song on iTunes. I also want to show the current playing song on Windows Media Player and WinAmp. My problem is the following:

If iTunes (and I'm assuming WinAmp or Windows Media Player) aren't open or the music is paused and now Current Song is being passed, my program freezes. These are the steps I've taken to showing the Current Song.

1) I've added iTunes 1.8 Type Library to my project

2) In Form1.vb I've added the following code above Public Class Form1:
Imports iTunesLib
Imports System

3) In a Timer I have the following code:
Dim itunesapp As New iTunesApp
SongNameToolStripMenuItem.Text = (itunesapp.CurrentTrack.Name)
SongArtistToolStripMenuItem.Text = (itunesapp.CurrentTrack.Artist)
SongAlbumToolStripMenuItem.Text = (itunesapp.CurrentTrack.Album)


Now, I have a few questions.

1) How can have my program not freeze if iTunes is paused, not playing music or is not open.
2) When I try to close iTunes while this is running, it says that another program is using iTunes. How can I avoid this
3) What if the person running this application doesn't have iTunes installed on their computer Will Question 1 solve my problem

I know Windows Live Messenger, Google Talk, etc. all overcome these issues somehow and "silently" listen to what iTunes/WMP/WinAmp are listening to.

Thanks for reading and responding!
~ Kokkei Mizu


Re: Visual Basic Express Edition iTunes COM Problem

Bruno Yu - MSFT

Kokkei Mizu,

1. What is the exact meaning for the "freeze" Do you mean all the functions of your program cannot work when the iTunes is paused In order to avoid your program freeze, I suggest you to add a "If ...Then..." code block, jump this event and continue to implement the other functions. I guess you use the iTunesLib for playing or opening the music, this causes the freeze of your program. So please change other functions to play your music.

2. "Another program is using iTunes" shows one of your thread is using this compenent. Please open your task manager and have a look at the threads. If necessary, just close the threads that use this component.

3. You can recommand the user to download the iTunes SDK or some other related components to help running this component. Here I found the Development Kits for this issue: http://developer.apple.com/SDK/

If you have any questions, please reply me.






Re: Visual Basic Express Edition iTunes COM Problem

Kokkei Mizu

What do would you suggest I put in the If ... Then ...

And this program is going to be used widely by others. I want the process of finding the now playing music quick and easy on their side of things.

Do you know how you load a COM on command, and only if the program is installed, or open




Re: Visual Basic Express Edition iTunes COM Problem

Kokkei Mizu

Can I please receive an answer to this problem




Re: Visual Basic Express Edition iTunes COM Problem

Bruno Yu - MSFT

Kokkei Mizu,

1. If iTunes paused Then continue playing and open.

2. Load a COM on command, do you mean you would like to register the component by command Just use regsvr32 ComName.dll.






Re: Visual Basic Express Edition iTunes COM Problem

Kokkei Mizu

Thanks for your response, but I have figured out some methods to going around these problems. And this program is going to be used by other people, so iTunes being paused might be natural for them to do.

But this has been answered!




Re: Visual Basic Express Edition iTunes COM Problem

adrian gutierrez

a can put rhe new program of itunes