View Full Version : Need Help @ getting the current file name, please
TOT1
13th March 2002, 21:21
Hello,
i have a small prob with winamp. i try to get the filename of the current track.
I read the faq on the winamp hp, but there was only a c++ source and i'm trying to make an vb app :)
Dim index
index = SendMessage(WinAMP_FindWindow, WM_USER, 0, 121)
Label2.Caption = SendMessage(WinAMP_FindWindow, WM_USER, index, ???)
I tryed to get first the current playlist item and then the filename, but i don't know the correct number :(
can someone help me please ?
cu
Gourou
14th March 2002, 00:24
if your not a plugin, you cant get it anyway, at least I dont think, I tried several times but gave up, but going about it is a lil more difficult than the code you have, here's how I know of to get it..
first off, the number you need is 211
secondly, if you manage to get that far, what that returns wont be a string, but rather a pointer to a string in memory, here's where you need to get smooth. Declare a fixed length string of 256 characters in length, fill it with 0's, meaning zeros, next, using the CopyMemory Api in windows to copy the string from the pointer given you, to the string you created..
Declare Sub CopyMemory Lib "kernel32" Alias "RtlCopyMemory" _
(ByVal Dest As Long, ByVal Source As Long, strLength As Long)
in reverse order again, strLength is 256, Source is the LONG POINTER!, nothing else, no string, no nothing, make sure you Declare Source as long, this is what gets returned by the 211 function, it must be long or it will crash, and remember, it's only a pointer.
Dest is also a pointer, but the pointer to your own string..for reasons I still dont understand, I cant simply pass a string to it, it doesnt work :( , so what you do, is this, Dest = StrPtr(YourDestVar)
That will return a pointer to the contents of YourDestVar, which the copymemory api should fill up with the filename called by the 211 function!
hehe, now if you follow those near gibberish instructions, your in luck, if not, I'm used to it, ask, and I'll dig up some code :)
Scrag that, I'll make it easy, but remember, this will only work if you compile to a referencable dll that winamp can load..
Dim index As Long
Dim Dest As Long
Dim Source As Long
Dim DestString As String * 256
index = SendMessage(WinAMP_FindWindow, WM_USER, 0, 125)
Source = SendMessage(WinAMP_FindWindow, WM_USER, index, 211)
Dest = StrPtr(DestString)
CopyMemory Dest, Source, 256
Label2.Caption = DestString
'''
And I think that's it, if it doesnt work, has a beef, slags your computer, or eats your pets, dont gripe at me, that code should work :D
TOT1
14th March 2002, 11:33
Hello,
This code:
Declare Sub CopyMemory Lib "kernel32" Alias "RtlCopyMemory" _
(ByVal Dest As Long, ByVal Source As Long, strLength As Long)
don`t works on my system, my kernel32 don'`t have a RtlCopyMemory Sektion. :(
i have win xp, but i don't know what win98 or other windows say
In the MSDN Library is a text :
Here’s the long, strange story of how the Win32 function for copying raw memory came to be called CopyMemory, even though there’s no such function in Visual Basic or in the Windows API.
Ps: Can i get the Info Ticker of winamp instead ? :) This would be enough
Gourou
14th March 2002, 19:59
your right, you dont have a copymemory section, you have a move memory section with a twist, sorry about that :( , here's the proper Declare...
Public Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (ByVal DestinationPointer As Long, ByVal SourcePointer As Long, ByVal Length As Long)
I think that's all I screwed up, but I dont know for sure :hang:
P.S. no, I've never seen a way to get the ticker, I think it's just created from the data you can get with the api
TOT1
15th March 2002, 12:45
hello,
sorry but the source doesn't work :( can you please write me the hole code ?
I have tryed to test the code, but then my prog shuts down :( with a memory failiture (this problemn is on other machines, too).
I would be very happy if u can help me :)
cu
Gourou
16th March 2002, 01:56
if your not a plugin, you cant get it anyway,
I have no idea why your having the memory problem, I just tested all the code again and it semi-works for me, meaning it should work,it just doesnt cause it's not a plugin, and I've given up trying, I have alternate methods to get it, which work just fine for my program, sorry dude, I just dont know what else to tell you
TOT1
19th March 2002, 21:07
Hello
i have tetsed the source, but i came to no result :(
if i use a plugin or an stand alone exe, is the same. But i'm already serching for a solution :(
cu
Gourou
19th March 2002, 22:55
here dude, this was my solution http://www.csc.uvic.ca/~karvanit/winamp/
I have no clue if it will actually help you or not, my programs were web based anyway, so tossing it a request on local host is close enough to instantaneous that it didnt matter, I just dont know if you'll have the same luck..as a note tho, making 6500 queries for my playlist takes about 10 minutes, so I hope you can find a better solution, I've been looking for one also, so I'll tell you if I find anything
ChrisRGZ
19th March 2002, 23:26
Grab a copy of the WinampCOM plugin then use the .CurrentFilename property. Simple as that!
wa21guy
20th March 2002, 10:37
Adding to this topic...
Is there any open source plugin/VB6 code that will allow me to get the file path of the song currently being played in WinAmp? I don't want the file name, but the path to the file. Anyone know if this can be done using VB code?
If it can be done, please post some quick sample code.
Thanks!
Ethan
Gourou
20th March 2002, 19:55
To ChrisRGZ: WinampCom grabs the current filename, all nice and dandy, but what I needed was the filename of every song in the playlist, in order..not an easy thing to ask for, I think he might need the same thing, my reason was I needed the filename so I could toss it to my cgi plugin and have it make a url from the filename so ppl can download the song, current would have worked, but I wanted based also on the previously played list, and the full list, not all 200k plus songs I own, just the ones in the list..
To wa21guy: Grab the filename, which should be the full name, path and all, and grab everything to the left of the last "\", InStrRev() is the easiest function for this, as it will return the index position of the last "\" in the filename, then you can use a Left() to grab everything at index -1, so on and so forth, you get the drift
TOT1
20th March 2002, 21:13
ChrisRGZ
Thanks for your tip, this is what i want :)
cu
PS. Thanks to everybody who tryed to helh me too :)
wa21guy
21st March 2002, 08:47
So the above examples that get the filename actually get the full path and filename? For example, they return:
c:\myfolder\myfolder\testsong.mp3
??
If so, then this is exactly what I need. Is there anyway to do this extrernally without actually being a "plug-in" of winamp (using VB)?
Thanks a bunch guys.
Gourou
21st March 2002, 21:04
I did some rooting around and unknown to me before, WinampCom DOES have the ability to give you back the filename for any name in the playlist, just download that, follow the example, and you should have all you need, with a much easier way to nab em.
wa21guy
21st March 2002, 23:36
Yep, just got WinampCOM last night and it works perfect! Much easier.
Now, for another question. Does anyone know how to read/write ID3v2 tags (specifically the album cover picture in the tag) in a plug-in written in VB6?
Thanks!
Gourou
22nd March 2002, 20:29
lol, you dont ask much dude :D
I honestly have never found a way to do ID3 tags with vb, I know you can, but here's a warning, vb gets messy with pointers if you arent careful, and as you saw before, pointers dont work very well in visual basic. Winamp doesnt have much support, but see if you can find the 'official' home page for ID3, and check around in their forums for some programming help, your sure to find it
Milgeo
23rd March 2002, 09:59
I just had myself an Eureka! experience trying out the WinampCOM plugin. But does anyone know where to find a listing of the different properties (like oWinamp.Play, oWinamp.Stop etc.)?
wa21guy
23rd March 2002, 12:33
There is a great MP3 ID3 Tag manipulater DLL by www.audiopimp.com called ID3Edit.dll. I'm using it in my plug-in and so far it works awsome!
As far as the oWinamp stuff, all you need to do is Reference the DLL in Visual Basic and by typing "oWinamp." a whole list should come up after the dot. If no, just right click and go to "List Properties/Methods"
Ethan
Gourou
23rd March 2002, 13:18
an obscure yet nice feature, is the object browser, just press F2, then select your object from the list where it says <All libraries>, then maximize the window and look through the lists of classes and members (methods and properties) that the object supports :)
Also, if the object isnt listed, then you need to reference the dll, then put it as a new object, that's in the readme help for the dll, dont forget to do that
Milgeo
23rd March 2002, 16:17
Thank you, Ethan and Gourou! That helped a lot.. I'm pretty new to VB, and actually forgot about this autolist feature. And that F2 function was just wonderful, Gourou. Thanks. :)
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.