|
|
#1 |
|
Junior Member
|
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 |
|
|
|
|
|
#2 |
|
Junior Member
Join Date: Mar 2003
Location: Pretoria
Posts: 4
|
Hi Thx
Try SendMessage(HwndWinamp, WM_USER, data, ByVal 122) Michael |
|
|
|
|
|
#3 |
|
Member
|
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 |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Dec 2002
Posts: 3
|
I am using this code:
code: and it does nothing at all - no error message Is this right? Can someone please correct it? |
|
|
|
|
|
#5 |
|
Member
|
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 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|