|
|
|
|
#1 |
|
Junior Member
|
Get current song?
I am trying to make a small app that when run will get the file name of the song currently playing, then pop up a box asking if I want to delete it, if yes is chosen, winamp will switch to the next song, and the file that was playing is deleted.
Err...so I need to know how to get the currently playing file...and Im sure I can figure out how to make it go to the next song, I saw it in the SDK. (PS: I wanna do this so I can set one of the keys on my logitech KB to run the app, I really really really need to clean my play list, and this seems to be a simple way to do it )
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Apr 2001
Posts: 269
|
Actually a surprisingly good idea
I like it! However if I remember correctly (which I probably) don't its only possible to access information such as filenames of the current track as a plugin, not a standalone application. As a standalone application there's a message you can send to the Winamp window that returns the currently playing track name and I think track id, but I don't think you ca get the filename. I'm sure someone will correctly if I'm (no-doubt) wrong. However perhaps you could write your 'app' as a plugin in a similar fashion to the already existing hot-keys stuff so it'll respond to a key-press 'ctrl-alt-d' or something ?
|
|
|
|
|
|
#3 |
|
Junior Member
|
Hmm thats also a good idea. I was inspired to do this cause I bought this logitech elite keyboard with all these useless buttons. But now its kind of pointless to research this cause when I open my winamp it playes for 3-8 seconds then closes.
|
|
|
|
|
|
#4 |
|
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
code: |
|
|
|
|
|
#5 |
|
Junior Member
|
Wow! Thank you very much!
You went and did it all...heh. Ive never seen how to recycle bin files in C++ before, darn nifty stuff. I think ill throw in like a 250ms sleep after it skips the file so that it gives it some time to actually complete it. Ill fiddle with it all and if I make any big changes Ill post em.
|
|
|
|
|
|
#6 |
|
Junior Member
|
Ok....question this...where do I find shellapi.h?
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Apr 2001
Posts: 269
|
Well in my case : C:\program files\Microsoft Visual Studio\VC98\include ... but that should be one of the (or *the* one default include path on a VC project, so it should pick it up immediately!)
|
|
|
|
|
|
#8 |
|
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
I think the SendMessage may not return until the song is actually advanced (including the fading out of the last song).
I was originally going to put in a sleep, but, I didnt have any file locking problems, but maybe i didnt test all cross fading options. The attached file has the compiled version. |
|
|
|
|
|
#9 |
|
Junior Member
|
Yeah, works great.
I had a bit of trouble getting it to work right with C++ in VS2003 tho. You dont need the shellapi.h Thanks again
|
|
|
|
|
|
#10 |
|
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Hmm, thats funny, Im using VS2003 and I definetly needed it. I don't need it if I strip out the #define WIN32_LEAN_AND_MEAN, because I guess windows.h then includes it.
But I guess then its not lean and mean then is it. Perhaps your project settings are wrong, just start with a blank win32 application (not console - you dont want that black screen) and add the .cpp file. |
|
|
|
|
|
#11 |
|
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
More stuff...
You must #include "shellapi.h"!
Maybe you are using "StdAfx.h" which may included it for some reason... And how do you get the selected item(s) in the playlist (not the current playing one). I mean those which are highlighted. |
|
|
|
|
|
#12 |
|
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
You cant. You can write a media library plugin which adds to the send to menu. And winamp will hand them to you when your item is clicked.
Or you can do an ugly windows hook hack and fake the 'playlist entry' command, and intercept the creation of the playlist entry dialog, hide it, read the entry, then destroy it. Winamp does this for every entry thats selected so it effectively gives you the selected items. if you wanna go down that route. otherwise, you can continue to badger nullsoft to provide this api. |
|
|
|
|
|
#13 |
|
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
Maybe faking the 'playlist entry' command, and intercepting the creation of the playlist entry dialog works, but it doesn't give you the index values. Only the filenames is returned but you can use IPC_GETPLAYLISTFILE and search for the filename in the playlist. Then you will get the index, right??
|
|
|
|
|
|
#14 |
|
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
If thats what you want to do, of course it would work. But consider that could involve doing a sendmessage and strcmp for 5,000+ items in a playlist. Pretty messy.
|
|
|
|
|
|
#15 |
|
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Note its probably easier to use IPC_CHANGECURRENTFILE on each item, then retrieve the playlist position. Still would be nice if nullsoft made an api for selection easier. Its not like the code doesnt already exist, just make the 'send to' functionality available as an API. They added special code to support gen_ml 'cause they realised it wasnt possible to do, you'd think they would have made it available to any plugin.
Anyway... I think I have worked out a much cleaner hack of getting this done, not involving hooking or hidden windows etc, or other major hacks. I'll post my findings if Im succesfful. (EDIT.. nah just some false hope.. didnt quite work the way i expected). (EDIT2: or maybe it does...
Last edited by shaneh; 1st September 2004 at 03:24. |
|
|
|
|
|
#16 |
|
Junior Member
Join Date: Sep 2004
Posts: 1
|
Can somebody tell me with what code I can retrieve the filename or title of the song currently playing in winamp?
It has to be done from an external application! I tried IPC_GETPLAYLISTFILE, but it returns nothing Thanks, Kristof De Vos |
|
|
|
|
|
#17 | |
|
Join Date: Sep 2003
Posts: 27,873
|
Quote:
but you can work around it by using ReadProcessMemory (and there are examples in this forum...) -daz |
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|