Pandora VB/VS 2005 "Minimize to System Tray" Player
Since I read about Pandora, I’ve been listening to it non-stop. But as I mentioned before, it bugs me that I can't minimize it to the system tray.
Finally I stopped obsessing about it (Who me? Obsessing about something? Na… ;)  and I took a few minutes and built my own VB/VS 2005 host for it, using the updated WebBrowser and NotifyIcon controls.
Now I have a Pandora Player that I can minimize to my system tray! Yeah. Instead of being hosted in IE, it's just hosted in the new WebBrowser control… No hacking, content removal, etc, etc.
It’s very easy to do…
- Create a new VB project
- Add a WebBrowser control to the form
- Dock the control to the Parent (i.e. Docking = Fill)
- Add a NotifyIcon to the form
- On the NotifyIcon SmartTag, select “Choose Icon” and pick a icon somewhere on your system.
- Paste in the below code to the form.
- You’re done! You now have System Tray Pandora Player.. Yeah!
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://www.pandora.com/?cmd=tuner")
End Sub
Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
Me.Show()
Me.WindowState = FormWindowState.Normal
NotifyIcon1.Visible = False
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
NotifyIcon1.Visible = True
Me.Hide()
End If
End Sub
End Class
Update #1 11/13/2005 @ 2:14 PM (PST):
There's one thing that is a little weird...
The Flash player does not respond to clicks unless you first click on the hosting web page. For each click you want to make on the Flash app, you must first click on the web page and then the Flash app...
So if you want to pause the playing, click on the web page area above the player and then click on the pause button... If you want to say "I Like it" on a song, click on the page, the song (to get the song menu), the page again and then finally on the "I Like It" menu item.
Yeah it's kind of a pain but for me its worth it to have a SysTray player... Your milage may vary, yada, yada, yada...
8 comments:
Did you find a way to load the page in your application in Minimize mode?
Solve the weird "click the page then click the Flash control" thing that I talked about in Update #1?
Nope, not yet... But I havn'r really tried hard either. I still use the app (pretty much every day) and the issue isn't that big of one so I live with with for now.
I am thinking that to solve this I might need to move beyond the WebBrowser control and directly host IE on the page (http://coolthingoftheday.blogspot.com/2006/03/extending-net-20-webbrowser-control.html)
Seems lovely, but way too technical for me. If it's not a Firefox xpi or Google/Opera widget I'm lost! Gotta love the Pandora though!
You can also use the Microsoft Web Browser COM object to get around the Flash clicking problem.
I compiled a C# version and threw it up on my site.
Download here: http://www.silassewell.com/blog/article.php?article=3
Great tip, thank you.
With a quick tweak, my PandoraPlayer is using the Microsoft Web Broswer COM control and now the Flash click issue is resolved.
Less than two minutes of work and an irritating problem is resolved... Now that's a tip! :)
Thanks again...
http://silassewell.googlepages.com/pandora
Try this app at http://openpandora.googlepages.com/
Some of the things that the OpenPandora project does looks pretty interesting. Thanks...
Post a Comment