A quick google tells that it should be possible to do like this in C++/CInSim
// Get current position in the playlist int curPos = SendMessage(hWinAmp, WM_WA_IPC, 0, IPC_GETLISTPOS); // Read the file title char* title = SendMessage(hWinAmp, WM_WA_IPC, curPos, IPC_GETPLAYLISTTITLE);
Because the SendMessage call returns a pointer to the string with the song's title, one would have to write this as a WinAmp plugin or use WinAmpMiniMagic (the sample code for that almost made my lunch go back on the plate though).
EDIT: BTW I just noticed the method chaining style in PRISM, pretty neat gotta say
Doing it reliably with WndProc messages is kinda hard, as it does need to run as a WinAmp plugin, but you can hack it together by finding the HWND of the WinAmp window, getting the window text and parsing what you need out. With Win32 you can do this with FindWindow and GetWindowText.
In C# you can just use the System.Diagnostics namespace.
using System.Diagnostics;
static string GetCurrentSongTitle() { Process process = Process.GetProcessesByName("winamp").SingleOrDefault(); if (process != null) { string title = process.MainWindowTitle; if (!String.IsNullOrEmpty(title)) { int index = title.LastIndexOf(" - "); if (index > -1) { return title.Substring(0, index); } } return "Unknown song"; } return "WinAmp not found"; }
Is the window title way guaranteed to work? It's been a while since I moved away from Winamp, but as I recall it it was quite moddable. As long as Winamp always sets its window title like this, it would probably be a viable solution.
Can someone make an "app" or a plugin for winamp from the mentioned solutions above ? Im not a programmer if anybody have a bit free time could make for our happy. It would be so nice while driving and others see the song played at me ... Musics are quiet good discussion when players are not playing just spectating and chatting ! Sorry for my english grammer ... :/
It will probably not handle songs with wrong or non-English characters well, but I really can't be bothered to fix nuances like that. I hate the way it's written, but under the ugly Winamp stuff is something that looks pretty neat so far and I might turn it into high-level C++/Qt based InSim library one day
(The executable is huge because it has half of Qt compiled in statically)
-- LINK REMOVED --
That's what I got when tested it in LFS start screen. Both clientside insims Aonio and LFSrelax asks for that admin pass too.
Edit: Deleting admin pass from start new host solved this. But it somehow doesn't show full title,as always the 1st letter from atrist is missing and last 2 letters from song name. Even both are very short and should fit in LFS message.
Edit 2: Same shows in applications main window (about the missing letters)
I know, I just didn't expect anyone to have the admin password set as that's something you'd probably want to use only if you run a private server. I put very little effort into this hack so it always assumes that the password is blank
When I last looked into it, that was the officially recommended (and only, short of writing a proper plugin) way of grabbing the song title from Winamp.
I knocked up a quick implementation in C/C++ using this method a couple of years ago that displays the current track in a button - still works today. It's also possible to use the Winamp API to control Winamp via InSim (if you'd ever want to - I did it as an experiment).
Edit: Of course, this method will break if you set the Winamp window title to scroll.
Since I discovered a rather stupid bug in the app, I eventually decided to reupload it, this time with the option to enter admin password. http://dl.dropbox.com/u/37342755/WinAmper2.7z
It worked for me, it might your firewall blocking it or for some reason the app cannot connect to LFS through "127.0.0.1". I can't think of anything else ATM.
I added the app for firewall exclusion, and I added special rights for the folder but nothing ... o.O If were a log file to show the problem were better !!!
I might have gone blind but from the screenshot it looks like LFS is not running on your machine so the app has nothing to connect to. You have to start LFS and init InSim first.
The only way I can reproduce this issue is by not enabling InSim in LFS. If you're sure you have InSim enabled and it's working with other applications, then I have really no idea what would cause such a problem expect for the statically linked exe being somehow magicowierdly broken...
I use LFSlapper version 6 and its perfectly working with LFS. Maybe tomorrow I will look the source code of Winamper and if I have luck I will find the problem
I'm not sure it would work like that because LFS would most likely intercept the Winamp shortcut (unless Winamp sets its shortcuts as global which I doubt). You'd also have to do that every time you play a new song, the whole point of this tiny app is to spam the LFS chat with "I'm currently listening to" kind of messages.
The app worked on another W7 machine, so there's got to be something specific about your machine. "Connection refused" usually means that an application is trying to connect to a non-existent address or port, which doesn't appear to be the case here.
Could you change something to make the app to make a log file with error... So with this file we should know why wont connect to LFS. port or something other !
I think maybe here is the problem why I cant connect
If there's an error during connecting, the application displays error returned by QTcpSocket::errorString(). You can see how the connection is created in InSimComm::initialize(), the application creates a socket, tries to connect and blocks for 5 seconds. If a connection is not established by that time or an error is reported, an error string is returned. There's nothing more to log.
This method works fine on two Windows and one Linux box, so unless there's some obscure bug in Qt, I don't see where it could trip.