PDA

View Full Version : Winamp API problems


Delaver
11th June 2002, 19:37
I have a problem using some of the API commands for winamp.

Its all the IPC messages i send to the winamp window, they all return a value of 1. Instead of the value I requested.

For example, the message IPC_ISPLAYING (104) always returns 1, no matter if winamp is playing, is paused or stopped.

Another example is IPC_GETLISTLENGTH (124), it also returns 1, even though I have 55 tracks in my playlist.

I use VisualBasic 6 to call the 'SendMessage' function in User32.dll library. More exactly:
---
lngCount = SendMessage(hwndWinamp, WM_WA_IPC, 0, IPC_GETLISTLENGTH)
---

WM_WA_IPC is set to &H400, the same as WM_USER, I use Winamp version 2.78.

Anyone who know why this is like it is?

Gourou
12th June 2002, 07:17
post your SendMessage API declare

Delaver
12th June 2002, 13:10
I use this declare, in VB6

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

Running under WinXP Proffesional.

Gourou
12th June 2002, 18:53
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

that should fix your prob :) :up:

Delaver
13th June 2002, 10:21
Thanx alot! It worx now :D

Gourou
13th June 2002, 14:02
umm, a note to anyone that reads this, ByVal sends the value of a variable or constant, without it, it sends the string value of the variable, and in this case, it was also sent as Any, so it was doubly confusing itself, if you check out PostMessage, this one is how it should be, the API declare is this way so one can send like a filename, or other text data to a control or window without using a data structure, watch out for it.

Delaver
14th June 2002, 14:06
ok, how exatly does this type send strings in the message?

Private Type COPYDATASTRUCT
dwData As Long
cbData As Long
lpData As Long
End Type

When i use WM_COPYDATA as messagetype

Gourou
14th June 2002, 14:18
because in that case, it sends a memory pointer to winamp, and winamp uses that pointer to access the string from your computers memory, it never passes the string directly, but the deal is, in like sendmessage, it passes a pointer to the string, which is just as useless, since it needs to pass the value of the variable, not a pointer to it, when you use the data structure, all the data is either values declared, or pointers previously found