How to manage iTunes through winForms
I see the same question answered ( How can I play a specific song in iTunes via java? ), But that doesn't really answer the question (anyway, I don't think so).
I have several buttons on a winform (play, pause, skip forward, skip back) and want to connect them via iTunes to create a "mini media player".
However I am having problems (obviously or I would not write this: P) with all this "COM" malarkey. I've tried to include (almost) every possible link from Apple, iTunes and still can't find a way to hit the play button and actually play the song in iTunes.
I have a button on a click event (I called the button btnPlay
). But does anyone know the "correct" or "efficient" way to connect iTunes to winforms?
I've heard of something called sendKeys
, but I'm a complete noob and have no idea how to create things like this.
PS. I also tried to find confirmation for using iTunesLib;
(from http://blogs.msdn.com/b/noahc/archive/2006/07/06/automating-itunes-with-c-in-net.aspx ) but this is a dated post. and I'm not sure if this namespace is already available (well, I still can't find it anywhere in Com references
.
As always, any help is greatly appreciated.
Add a link to the iTunes 1.xx type library (it will be in the COM links list).
Then you can use iTunes app as such in your click event
iTunesApp app = new iTunesAppClass();
app.Play();
you will need to follow the next step to implement the COM iTunes application.
Go to the Solution Explorer.
Right click on References –> iTunesLib and hit Properties.
Set "Embed Interop Types" to False.
source to share