Search Tools Links Login

Get Current Winamp Song


Visual Basic 6, or VB Classic

This Function gets the current winamp song. I got tired of people iming me asking for this and me redoing it each time.

Original Author: -=Pc=-

Code

Option Explicit


'To Use Just Do

'Call MsgBox(GetSong)

'And it will popup a message box with the song.



Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long



Public Function GetSong() As String

Dim WinampCaption As String

Dim CaptionLength As Long

Dim Winamp As Long

Winamp& = FindWindow("Winamp v1.x", vbNullString)

CaptionLength& = GetWindowTextLength(Winamp&)

WinampCaption$ = String$(CaptionLength&, 0)

Call GetWindowText(Winamp&, WinampCaption$, (CaptionLength& + 1&))



If WinampCaption <> "" Then

GetSong = WinampCaption

Else

GetSong = "Error"

End If

End Function

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 113 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.