Old 2nd June 2003, 12:12   #1
sid2k
Junior Member
 
Join Date: Jun 2003
Posts: 1
Send a message via ICQ to sid2k
vb

trying to communicate to winamp with a vb6 program.

found the hwnd,
i call the sndmessage api this way:

ret = SendMessage(hW, WM_USER, 0, 122)


this should set the volume to '0'
but vb writes: "type mismatch' on the id field (122)
how can I fix this problem?

thx
sid2k is offline   Reply With Quote
Old 7th June 2003, 21:20   #2
msing
Junior Member
 
Join Date: Mar 2003
Location: Pretoria
Posts: 4
Hi Thx

Try
SendMessage(HwndWinamp, WM_USER, data, ByVal 122)

Michael
msing is offline   Reply With Quote
Old 17th June 2003, 21:04   #3
enki3600
Member
 
Join Date: Jun 2003
Location: Iowan Cornfields.
Posts: 61
Send a message via ICQ to enki3600 Send a message via AIM to enki3600 Send a message via Yahoo to enki3600
constants (ie: numbers typed from the keypad, dunno about user defined constants) should be passed byval as default, though make sure in your declare statement that all of the arguments are listed as ByVal and (having read that you are changing the volume) type the function as a number as well... particularily the declare statement should look like:

Public Declare SendMessage Lib "user32" Alias "SendMessageA" (ByVal HwndWinamp as long, ByVal WM_USER as Long, data as Long, ByVal id as Long) as Long

also, for good measure you may want to send the data arg as
0&
rather than just 0 .. this types it as a Long rather than an Integer. (which could very well be the issue)

enki
enki3600 is offline   Reply With Quote
Old 23rd June 2003, 15:22   #4
|-|1T|\/|4|\|
Junior Member
 
Join Date: Dec 2002
Posts: 3
I am using this code:
code:
Public Const WM_COMMAND = &H111
Public Const WM_USER = &H400
Public HwndWinamp As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal HwndWinamp As Long, ByVal WM_USER As Long, data As Long, ByVal id As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Sub prevTrack()
HwndWinamp = FindWindow("Winamp v1.x", vbNullString)
If hwndWinamp = 0 Then
MsgBox "Winamp is not running!", vbCritical, "Error"
Exit Sub
End If
SendMessage HwndWinamp, WM_COMMAND, 40044, 0&
End Sub


and it does nothing at all - no error message
Is this right?
Can someone please correct it?
|-|1T|\/|4|\| is offline   Reply With Quote
Old 23rd June 2003, 16:54   #5
enki3600
Member
 
Join Date: Jun 2003
Location: Iowan Cornfields.
Posts: 61
Send a message via ICQ to enki3600 Send a message via AIM to enki3600 Send a message via Yahoo to enki3600
you need to put ByVal before the "data" argument in the sendmessage declare.
I use basically the exact same code in an applet I made for myself:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

hWndWinAMP = FindWindow("Winamp v1.x", vbNullString)
If hWndWinAMP <> 0 Then
SendMessage hWndWinAMP, &H400, 85, 122
End If
Main
End Sub
enki3600 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump