Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

Winamp Hotkey Gamepad Edition

Browsing WinampMod.bas (4.54 KB)

Attribute VB_Name = "WinampMod"

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 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
Private 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

Private Const WM_COMMAND = &H111
Private Const WM_USER = &H400

Public Function WAListStart() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WAListStart = PostMessage(WAHandle, WM_COMMAND, 40154, 0&)
End Function

Public Function WAListEnd() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WAListEnd = PostMessage(WAHandle, WM_COMMAND, 40158, 0&)
End Function
Private Function GetWinampHandle() As Long
    GetWinampHandle = FindWindow("Winamp v1.x", vbNullString)
End Function

Public Sub WASaveSongTitle()
On Error Resume Next
Dim strBuffer As String, strBufferLen As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Sub
    strBufferLen = GetWindowTextLength(WAHandle)
    strBuffer = String(strBufferLen, 0)
    GetWindowText WAHandle, strBuffer, strBufferLen + 1
    If InStr(strBuffer, vbNullChar) Then strBuffer = Left(strBuffer, InStr(strBuffer, vbNullChar) - 1)
    If InStr(strBuffer, "-") Then strBuffer = Left(strBuffer, InStrRev(strBuffer, "-") - 1)
    strBuffer = Trim(strBuffer)
    Open "C:\SongNames.txt" For Append As #1
        Print #1, strBuffer
    Close #1
End Sub

Public Function WATrackPrev() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WATrackPrev = PostMessage(WAHandle, WM_COMMAND, 40044, 0&)
End Function

Public Function WAToggleShuffle() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WAToggleShuffle = PostMessage(WAHandle, WM_COMMAND, 40023, 0&)
End Function

Public Function WAToggleRepeat() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WAToggleRepeat = PostMessage(WAHandle, WM_COMMAND, 40022, 0&)
End Function


Public Function WATrackNext() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WATrackNext = PostMessage(WAHandle, WM_COMMAND, 40048, 0&)
End Function

Public Function WAVolRaise() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WAVolRaise = PostMessage(WAHandle, WM_COMMAND, 40058, 0&)
End Function

Public Function WAVolLower() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WAVolLower = PostMessage(WAHandle, WM_COMMAND, 40059, 0&)
End Function

Public Function WATrackPlay() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WATrackPlay = PostMessage(WAHandle, WM_COMMAND, 40045, 0&)
End Function

Public Function WATrackFForward() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WATrackFForward = PostMessage(WAHandle, WM_COMMAND, 40148, 0&)
End Function

Public Function WATrackFRewind() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WATrackFRewind = PostMessage(WAHandle, WM_COMMAND, 40144, 0&)
End Function

Public Function WATrackPause() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WATrackPause = PostMessage(WAHandle, WM_COMMAND, 40046, 0&)
End Function

Public Function WATrackStop() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WATrackStop = PostMessage(WAHandle, WM_COMMAND, 40047, 0&)
End Function

Public Function WAPlaybackStatus() As Long
Dim WAHandle As Long
    WAHandle = GetWinampHandle
    If WAHandle = 0 Then Exit Function
    WAPlaybackStatus = SendMessageLong(WAHandle, WM_USER, 0, 104)
End Function

Download WinampMod.bas

Back to file list


Back to project page