Option Explicit
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal HWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal HWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal HWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal HWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Sub winampGetFileInfo(Optional strFilepath As String, Optional strTitle As String, Optional strArtist As String, Optional strAlbum As String, Optional strYear As String, Optional strComment As String)
'I coded this to only read the info from a Mp3, will freeze if file info box is not
' an id3 tag window. Can easily be edited.
Dim lngMpegFileInfo As Long
Dim lngEdit1 As Long
Dim lngEdit2 As Long
Dim lngEdit3 As Long
Dim lngEdit4 As Long
Dim lngEdit5 As Long
Dim lngEdit6 As Long
If lngWinamp = 0 Then Exit Sub
PostMessage lngWinamp, 273, 40188, 0
Do
DoEvents
lngMpegFileInfo = FindWindow("#32770", "MPEG file info box + ID3 tag editor")
lngEdit1 = FindWindowEx(lngMpegFileInfo, 0, "Edit", vbNullString)
lngEdit2 = FindWindowEx(lngMpegFileInfo, lngEdit1, "Edit", vbNullString)
lngEdit3 = FindWindowEx(lngMpegFileInfo, lngEdit2, "Edit", vbNullString)
lngEdit4 = FindWindowEx(lngMpegFileInfo, lngEdit3, "Edit", vbNullString)
lngEdit5 = FindWindowEx(lngMpegFileInfo, lngEdit4, "Edit", vbNullString)
lngEdit6 = FindWindowEx(lngMpegFileInfo, lngEdit5, "Edit", vbNullString)
Loop Until lngEdit6 <> 0
strFilepath = strGettext(lngEdit6)
strTitle = strGettext(lngEdit1)
strArtist = strGettext(lngEdit2)
strAlbum = strGettext(lngEdit3)
strYear = strGettext(lngEdit4)
strComment = strGettext(lngEdit5)
DoEvents
PostMessage lngMpegFileInfo, &H10, 0, 0
End Sub