Old 3rd November 2006, 23:01   #1
ThePike
Junior Member
 
Join Date: Nov 2006
Posts: 2
Getting album name in C# with IPC_GET_EXTENDED_FILE_INFO

Hi,

I need a way to retrieve the album name for the currently playing track in winamp...

I've been trying the whole day to convert the samples I've found on IPC_GET_EXTENDED_FILE_INFO into C# code but without much luck.

Here's what I have:

PHP Code:
[DllImport("user32.dll"CharSet CharSet.Auto)]
        public static 
extern int SendMessage(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] int Msgref extendedFileInfoStruct wParamIntPtr lParam);

const 
int WM_COMMAND 0x111;
const 
int WM_WA_IPC 0x0400;
const 
int IPC_GET_EXTENDED_FILE_INFO 290;
const 
int IPC_GET_EXTENDED_FILE_INFO_HOOKABLE 296;

//The structure
[StructLayout(LayoutKind.Sequential)]
public 
struct extendedFileInfoStruct
{
  public 
string filename;
  public 
string metadata;
  public 
uint retlen;
  [
MarshalAs(UnmanagedType.LPStrSizeConst 256)]
  public 
string ret;


//The code

extendedFileInfoStruct efi = new extendedFileInfoStruct();

efi.filename "c:\\track.mp3";
efi.ret "";
efi.retlen 256;
efi.metadata "ALBUM";

int i SendMessage(hwndWM_WA_IPCref efi, (IntPtr)IPC_GET_EXTENDED_FILE_INFO); 
Well, the API call returns 0 and winamp crashes...
Anyone know anything on how to properly set up and allocate the extendedFileInfoStruct structure in c#?

Does the song have to be added to the media library?
Are there better ways to get the album name of current track?
ThePike is offline   Reply With Quote
Old 5th November 2006, 02:42   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Search for WinampMagic, maybe you can reproduce the api convection into c#... that's why I still prefer plugins in C++


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 8th November 2006, 12:08   #3
ThePike
Junior Member
 
Join Date: Nov 2006
Posts: 2
Thank you that really helped. Took a while but now its working...
ThePike is offline   Reply With Quote
Old 19th December 2006, 00:02   #4
shao
Junior Member
 
Join Date: May 2001
Posts: 5
Did you manage to get this to work in your c# code? Is there any chance you could post the updated code?

Thanks in advance!
shao is offline   Reply With Quote
Old 16th May 2007, 06:12   #5
ChaosBlade
Senior Member
 
ChaosBlade's Avatar
 
Join Date: Nov 2003
Location: Israel
Posts: 115
Send a message via ICQ to ChaosBlade Send a message via AIM to ChaosBlade Send a message via Yahoo to ChaosBlade
I'm also interested in this. Please post any working C# samples you have for us to mess around with
ChaosBlade is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump