|
MsnMsgrUiManager
A Win32 window class implemented by MSN Messenger and other compatible messengers
Phase-Implementation, Featured IntroductionThe MsnMsgrUiManager window class is implemented by Windows Live Messsenger, MSN Messenger, and by any messenger application (or associated plugins thereof) that wish to receive "Now Playing" data from any media player application that supports sending such data to MSN Messenger. Known ImplementationsMessengersThe following instant messaging applications are known to implement the receiving end of the interface:
LibrariesLibraries that implement the receiver interface on the behalf of a messenger or status-display app:
Media PlayersThe following media players are known to implement the sending end of the interface:
DetailsThe MsnMsgrUiManager Now Playing interface is rather straightforward. The sender program (the media player) sends a WM_COPYDATA message to any and all windows matching the MsnMsgrUiManager window class using the SendMessage() function. The WM_COPYDATA message type requires the use of the COPYDATASTRUCT struct, which has three defined elements:
The actual message data passed via lpData is a wide-character string, terminated by a null character. The data fields are delimited by literal wide-character "\0" (literal backslash and literal zero, NOT a null-value wide character). The fields are described below:
So, in order, the final string looks like this (remember, this is entirely literals, nothing here is really escaped): "1\02\03\04\05\06\07\08\0" Now, assume the following information:
Then you would get the string: "PsyMP3\0Music\01\0PsyMP3: {1} - {0}\0Through The Fire And Flames\0Dragonforce\0Inhuman Rampage\0WMContentID\0". The format string is only used by Windows Live Messenger, and it would set the display on Windows Live Messenger to say "PsyMP3: Dragonforce - Through The Fire And Flames". You could omit the opening "PsyMP3" and start off with the first "\0"; the player name field there is an extension that originates from iTunes. Remember to escape the backslash in C strings, e.g. "\\0" in C (to get literal "\0") Once you have the string formatted, set the lpData element in the COPYDATASTRUCT struct to be the pointer to the message string. Set the cpData field to be length of the string, in characters, doubled, with two added after that, or in C, ((wcslen(message) * 2) + 2). Finally, set the dwData element to 1351. Once you have the COPYDATASTRUCT structure filled out, now it's time to pass it to the instant messenger application via SendMessage(). The first argument to SendMessage() will be the window handle to the messenger window (which you should have found using either FindWindow() or preferably FindWindowEx()). The second argument, the message type, is WM_COPYDATA, while the wParam argument (the third argument) is the hWnd of your program's window - you can set this to 0 if it is not applicable. The lParam argument (final argument for SendMessage) will be the pointer to the COPYDATASTRUCT structure. To clear the now playing from the messenger, send a message string with field 3 being "0" instead of "1". For more information, please reference the implementation in the PsyMP3 source code. |