Projects

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

Gateway Multi-function Keyboard Utility

Browsing Utility/WCDPlayerMod.bas (2.23 KB)

Attribute VB_Name = "WCDPlayerMod"

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As String, ByVal lpszWindow As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Long, wParam As Any, lParam As Any) As Long

Private Const BM_CLICK = &HF5

Private Function GetWCDPlayerHandle() As Long
    GetWCDPlayerHandle = FindWindow("MMFRAME_MAIN", vbNullString)
End Function

Public Function WCDPlayerTrackNext() As Long
Dim WCDPlayerHandle As Long
Dim WCDPlayerBtn As Long
    WCDPlayerHandle = GetWCDPlayerHandle
    If WCDPlayerHandle = 0 Then Exit Function
    WCDPlayerBtn = FindWindowEx(WCDPlayerHandle, 0&, "Button", "Next track")
    If WCDPlayerBtn Then WCDPlayerTrackNext = SendMessage(WCDPlayerBtn, BM_CLICK, 0&, 0&)
End Function

Public Function WCDPlayerTrackPlayPause() As Long
Dim WCDPlayerHandle As Long
Dim WCDPlayerBtn As Long
    WCDPlayerHandle = GetWCDPlayerHandle
    If WCDPlayerHandle = 0 Then Exit Function
    WCDPlayerBtn = FindWindowEx(WCDPlayerHandle, 0&, "Button", "Play")
    If WCDPlayerBtn = 0 Then WCDPlayerBtn = FindWindowEx(WCDPlayerHandle, 0&, "Button", "Pause")
    If WCDPlayerBtn Then WCDPlayerTrackPlayPause = SendMessage(WCDPlayerBtn, BM_CLICK, 0&, 0&)
End Function
Public Function WCDPlayerTrackPrev() As Long
Dim WCDPlayerHandle As Long
Dim WCDPlayerBtn As Long
    WCDPlayerHandle = GetWCDPlayerHandle
    If WCDPlayerHandle = 0 Then Exit Function
    WCDPlayerBtn = FindWindowEx(WCDPlayerHandle, 0&, "Button", "Previous track")
    If WCDPlayerBtn Then WCDPlayerTrackPrev = SendMessage(WCDPlayerBtn, BM_CLICK, 0&, 0&)
End Function
Public Function WCDPlayerTrackStop() As Long
Dim WCDPlayerHandle As Long
Dim WCDPlayerBtn As Long
    WCDPlayerHandle = GetWCDPlayerHandle
    If WCDPlayerHandle = 0 Then Exit Function
    WCDPlayerBtn = FindWindowEx(WCDPlayerHandle, 0&, "Button", "Stop")
    If WCDPlayerBtn Then WCDPlayerTrackStop = SendMessage(WCDPlayerBtn, BM_CLICK, 0&, 0&)
End Function

Download Utility/WCDPlayerMod.bas

Back to file list


Back to project page