• Welcome to Valhalla Legends Archive.
 

[VB6 - Solved] Get Winamp's Current Song Title via Memory

Started by PaiD, October 19, 2005, 06:40 AM

Previous topic - Next topic

PaiD

Hello

I was playing with Winamp and I recieve a pointer to where a value is that I want. How would I go about getting the value?


Public Function GetTrackName() As String
Dim hwndWinamp As Long
Dim TrackIndex As Integer, TrackPos As Long, Title As String * 256
hwndWinamp = FindWindow("Winamp v1.x", vbNullString)
'GetTrackName = SendMessage(hwndWinamp, WM_WA_IPC, 0, ByVal IPC_GETLISTLENGTH)
TrackIndex = SendMessage(hwndWinamp, WM_WA_IPC, 0, ByVal IPC_GETLISTPOS)
TrackIndex = TrackIndex + 1
TrackPos = SendMessage(hwndWinamp, WM_WA_IPC, TrackIndex, ByVal IPC_GETPLAYLISTTITLE)
CopyMemory ByVal Title, TrackPos, Len(Title)
GetTrackName = Title
End Function

I currently use CopyMemory Here and when I try this I get '8¯G' returned. TrackPos returns the value '4697912' which is the where the song title is located in memory. Am I reading the memory block wrong? or should I be using ReadProcessMemory and if so, How would I go about using this api?


Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

l2k-Shadow

It is quite unnecessary to use CopyMemory OR ReadProcessMemory to retrieve the current song... Use

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Public Function GetTrackName() As String
Dim strReturn As String * 256, hWnd As Long
hWnd = FindWindow("Winamp v1.x", vbNullString)
If hWnd <> 0 Then
GetWindowText hWnd, strReturn, 256
strReturn = Left$(strReturn, Instr(strReturn, vbNullChar) - 1)
End If
End Function


That should give you a good start.. After this feel free to parse the content of strReturn to suit your needs.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Adron

I thought GetWindowText did not work if you used scrolling song titles in the title bar?

PaiD

l2k-Shadow: Yes I know of this way. But I dont wish to retrieve it that way. Like Ardon says, it wont work if they have it scrolling. Also I was looking at the sdk for winamp that that api is available but only to "in process" plugins not external apps. Also I would like to find out how to get into the memory b/c there are more api calls I could use to make it easier and show more information that is only available to 'plugins'. So any help to find this out will help.


TrackPos = SendMessage(hwndWinamp, WM_WA_IPC, TrackIndex, ByVal IPC_GETPLAYLISTTITLE)

returns a pointer into the memory of Winamp.

Edit: Ok after looking some more on Winamp's forum I found a link that explained to me what I had to do. I was close (some what)


Warrior

Yea, in theory you were. Just need a few things done first. Nice job.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?