Windows Media Player

Started by
10 comments, last by Funkymunky 20 years ago
Hey, I''m trying to make a program for the LAN we have in my apartment here. We have one computer hooked up to some monster speakers which we use to play music at parties. We also have my computer with generic speakers and a laptop that sits in the living room. What I want to do is make a program that can control windows media player across the network. I think I can do the network programming pretty easily, but I can''t figure out how to mess with WMP. I downloaded the windows media series 9 SDK stuff, but can''t make any sense of how to use it. specifically, my call to CoCreateInstance to create the server object returns REGDB_E_CLASSNOTREG. Any help on using the SDK for simple stuff like playing/pausing/stopping a file and editing playlists? Could I maybe do it some other way, like with SendMessage calls or even command line options? Any help will be greatly appreciated by me and my roommates.
Advertisement
I''d I''d I''d.. I''d just send commands over the network, and let the other side (the clientside) read those commands and work with WMP.

--
You''re Welcome,
Rick Wong
- sitting in his chair doing the most time-consuming thing..
right..........how..........
#!perl# achtung: quick and messy serveruse IO::Socket;$PLAY = 0x1;$STOP = 0x2;# etc.$server = IO::Socket::INET->new(LocalPort=> $server_port,Type => SOCK_STREAM,Reuse => 1,Listen =>10)or die "Sorry: $@\n";while ($client = $server->accept()){  $server->recv($data_read, $maxlen, $flags) or die "Error.";  if($data_read == $PLAY){    system("wmplayer /Play myplaylist.wpl")  }  else if($data_read == $STOP) {    system("wmplayer /Stop");  }  else {    # more commands  }} 
   #!perl#achtung: messy messy clientuse IO::Socket;$PLAY = 0x1;$STOP = 0x2;$socket = IO::Socket::INET->new(PeerAddr => $remote_host, PeerPort => $remote_port,Proto => 'tcp', Type => SOCK_STREAM) or die "Error: $@\n";print $socket "$PLAY";print $socket "$STOP";#...close($socket);


[edited by - flangazor on April 5, 2004 1:15:27 PM]

[edited by - flangazor on April 6, 2004 7:18:38 AM]
WMP is an ActiveX Control (Correct me if am wrong guys), so you can host it in your own app. Have another thread in the same app that listens to network calls and translate those calls to control the ActiveX Cntrl. One caveat is that you should always control the activex control from the UI thread. Using C# simplifies your prorgramming a lot. I think there may be some articles on codeproject.com with regard to using the WMP in a C# app. Good Luck.
Damn, thanks for the help but I''m using visual studio 6, straight C++. Any more ideas?
Maybe the multimedia API...try searching for MCI Functions in ms sdk (pretty sure it plays video and audio).

You can also play with the winamp sdk, it is pretty easy to use.
You can do it in VC++ too. Create a MFC Dialog App and import the ActiveX Control. MFC will generate wrapper classes (extends COleDispatchDriver I think) for your ActiveX Control and you could call the methods (like Play...) on these Wrapper Class to control your WMP. Check out Programming in Visual C++ book by Dave Kruglinski which has an example on how to import an Activex Control into a VC++ app. You still have to use Winsock on another thread to listen to connections and invoke the methods on the wrapper class.
Also do you have to use WMP? Why not WinAmp? WinAmp comes with its own SDK and the last time I looked at it, it uses SendMessage calls to control it. I think the SDK had samples as to how you could use it and I remember someone providing a remote control interface to the player using SendMessage calls. It will simplify your task to a great extent. Just a thought.
Thanks, i''m gonna use winamp. Easy as cake!

This topic is closed to new replies.

Advertisement