Windows Live Messenger "What I'm listening to" function

628 views Asked by At

How can I use the Windows Live Messenger "What I'm listening to" function? How can I communicate with the WLM to send the song info, so Messenger can set the status? I'm coding in C++ (Qt)

I searched all the net but found nothing about it, not even in other programming languages.

EDIT:

Looks like i didn't make myself clear. I don't want a walkthrough. I want to know if there is an API, or library, or anything to communicate with the Windows Live Messenger to use that function, like media players such as WMP, Winamp and iTunes do.

I searched the Live Connect API, but I haven't found anything about that.

2

There are 2 answers

0
a3f On BEST ANSWER

As there are many open source projects implementing this feature which you could check up (like MPC-HC, PsyMP3, Songbird ... etc.), I'll just explain how it's done:

First you build a Unicode string looking like this:

Player\0Type\0Playing\0Format\0Artist\0Type\0Album\0GUID\0

(The \0's are NOT NUL, so make sure to escape them)

  • Player: Name of your Music Player
  • Type: Type of media, here: "Music"
  • Playing: 1 for playing, 0 for stopped
  • Format: The string next to "Now Playing", e.g: A3FPlayer: {1} - {0}
  • Artist, Title & Album are self-explanatory
  • GUID: WMCONTENTID

Then you build a COPYDATASTRUCT like this:

COPYDATASTRUCT data;
data.dwData = 0x0547; //1351 decimal
data.lpData = (PVOID)(LPCWSTR)MsnMsg;
data.cbData = MsnMsgSize * 2 + 2;

And finally pass that struct to the MsnMsgrUIManager handle which you would find with FindWindowEx:

HWND hWnd = FindWindowEx(NULL, NULL, L"MsnMsgrUIManager", NULL);
SendMessage(hWnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&data);
2
Kirn Gill II On

a3f provides a wonderful answer with a bit of code. However, if you do find his reply a little confusing, here's an "API" reference of sorts that I wrote while I was writing the interface code for PsyMP3. The only thing I would say is that I would write the GUID part as "WMContentID", as that's what I've seen Windows Media Player pass to MSN when I was snooping the window messages with WinSpy.

Anyways, my documentation for the interface in question is here:

http://code.google.com/p/psymp3/wiki/MsnMsgrUiManager