3

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.

Tyras
  • 103
  • 1
  • 7
  • you cant ask a question like this here. You should be specific! From your question do you expect us to give you a lecture on how to establish this ? You can ask programming related questions if you are struck with something. please read the faq!! – Deepak Oct 26 '12 at 01:17
  • 1
    Sorry, I think i didn't make myself clear. I'm asking if is there a library, or dll, or API or something like that that i can use to access that function. I saw several questions like this one, i didn't think that it was wrong to ask it. – Tyras Oct 26 '12 at 20:54
  • @Deepak: The OP's original (unedited) question seems pretty clear to me (although probably written in his second language) and looks like a good fit for the Q&A format of this site. Your comment, on the other hand, does not belong on this site: you come across as rude and patronising. This kind of communication with new users will not help SO grow as a resource. Read [this](http://blog.stackoverflow.com/2012/07/kicking-off-the-summer-of-love/). – sam-w Nov 18 '12 at 09:58
  • @sjwarnerthat comment from me was before the OP edited the post!! may be it doesn't suit the question now. Please ignore.. – Deepak Nov 18 '12 at 21:15
  • You could make your app to pretend that it is winap or other supported player, but it could cause some problems when your app and winamp was running at same time – Kamil Klimek Nov 19 '12 at 09:22
  • This is probably out of context but isn't MS killing WLM and moving to Skype... I don't really see a benefit in investing in such feature of an already dead product – Zaid Amir Feb 17 '13 at 14:44

2 Answers2

2

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);
a3f
  • 8,517
  • 1
  • 41
  • 46
1

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

Kirn Gill II
  • 90
  • 1
  • 6
  • Unfortunately, the link I provided no longer works since Google Code shut down and I set my project to redirect to GitHub. – Kirn Gill II Dec 29 '16 at 09:32
  • You can find an archival copy here: http://web.archive.org/web/20130222143055/http://code.google.com/p/psymp3/wiki/MsnMsgrUiManager – Kirn Gill II Dec 29 '16 at 09:33