View Single Post
Old 15th January 2011, 01:01   #1
Junior Member
Join Date: Jan 2011
Posts: 1
C# Get playing title

Greetings fellow developers, I'm making a small C# lib that queries Winamp for the currently playing song. So far I've written methods to get SampleRate, Bitrate, Channels, Position and Length of the playing song.

My problem is I cannot seem to make the IPC_GET_PLAYING_TITLE message to work.

My PInvoke of SendMessage:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);

And this is how I send the data and decode the result:
public static string GetTitle()
IntPtr result = SendMessage(GetWinampHandle(), WM_WA_IPC, IntPtr.Zero, IPC_GET_PLAYING_TITLE);
string title = Marshal.PtrToStringUni(result);
return title;

The resulting string is always empty ( "" ). The SDK doesn't say if this message can be sent from external apps, its located in a section that says it can only be used by plugins, but a few other messages in the same section just above the IPC_GET_PLAYING_TITLE explicitly say that they can be used outside of Winamp.

Any help, thought or comments are welcomed thank you.
Ravenhearty is offline   Reply With Quote