What you need are the actual messages to send (parameter 3). Parameters 4 and 5 should be optional. Here's the constants for Media Player when I develop in vb:
Const MEDIA_NEXTTRACK = 11
Const MEDIA_PREVIOUSTRACK = 12
Const MEDIA_STOP = 13
Const MEDIA_PLAY_PAUSE = 14
Use these in sendmessages this way. To send the stop message:
sendmessage "WMPlayerApp" "
Windows Media Player" 13 0 0
Here's a simple vb6 app that demonstrates the same:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const WM_APPCOMMAND = &H319
Const HWND_BROADCAST = &HFFFF
Const MEDIA_NEXTTRACK = 11
Const AMEDIA_PREVIOUSTRACK = 12
Const MEDIA_STOP = 13
Const MEDIA_PLAY_PAUSE = 14
Private Sub Button_STOP()
Dim hwnd As Long
hwnd = FindWindow("WMPlayerApp", "Windows Media Player")
If hwnd <> 0 Then
SendMessage hwnd, WM_APPCOMMAND, hwnd, _
ByVal (MEDIA_PLAY_PAUSE * &H10000)
End If
End Sub
Bookmarks