VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get Current Winamp Song

by -=Pc=- (1 Submission)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

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

Rate Get Current Winamp Song

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

Download this snippet    Add to My Saved Code

Get Current Winamp Song Comments

No comments have been posted about Get Current Winamp Song. Why not be the first to post a comment about Get Current Winamp Song.

Post your comment

Subject:
Message:
0/1000 characters