Is there a way to get Winamps and or Windows Media Players current media with VB6?
Printable View
Is there a way to get Winamps and or Windows Media Players current media with VB6?
What do you mean by "current media"?Quote:
Originally Posted by frozen
For WinAmp, you can find current playlist in WinAmpPath:\\WinAmp.m3u.
No idea how to get the 'now playing' file.
to get the current song being played by Winamp, try this:
HarshVB Code:
Option Explicit 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 Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Private Sub Command1_Click() Dim Wmp As Long, strSong As String, Buff As Long 'here Winamp v1.x is the classname of Winamp, and is different for 'different versions i suppose, so check the classname using Spy++ Wmp = FindWindow("Winamp v1.x", vbNullString) If Wmp <> 0 Then Buff = GetWindowTextLength(Wmp) strSong = Space(Buff + 1) GetWindowText Wmp, strSong, Len(strSong) 'when winamp plays a song, it includes "- Winamp" at 'the end, to eliminate it use strSong = Replace(strSong, " - Winamp", vbNullString) MsgBox "Song Playing: " & strSong Else MsgBox "Winamp is NOT open", vbOKOnly, "Error - Winamp not found" End If End Sub
How would I get this to work for WMP 11?