Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   Winamp Development (http://forums.winamp.com/forumdisplay.php?f=14)
-   -   Ipc_setvolume (http://forums.winamp.com/showthread.php?t=203152)

Juicy2k 27th December 2004 10:00

Ipc_setvolume
 
Hi there..

I've been coding an external program that will listen over TCP/IP and relay commands on to winamp (for a network jukebox :)) and I've run into a problem.

I've not got any dodgy plugins, I'm using version 5008 of winamp and my other code (play, pause, stop, etc) works fine.

The line that's giving me problems is below:

SendMessage(winamp_hWnd, WM_WA_IPC, iVolume, IPC_SETVOLUME);

my hWnd is fine, the constants are defined and I've tried making sure iVolume is various types to maybe satisfy the API.

Has anyone else had this problem or can see what I'm doing wrong?

eleet-2k2 27th December 2004 14:53

It seems to work fine for me, here's what I did (it's VB):

code:
Public Const IPC_SETVOLUME = 122 'set volume (0-255)

Public Function SetVolume(Volume As Integer) As Long
'Sets the volume (Volume must be between 0 - 255)
SetVolume = SendMessage(hwnd_winamp, WM_WA_IPC, Volume, IPC_SETVOLUME)
End Function


Juicy2k 27th December 2004 18:57

Solved it. For some reason winamp wasn't working with SendMessage (just on this one command), so I'm currently using SendNotifyMessage. This does work.

Why SendMessage doesn't work, I don't know. But I have a solution now, so I'm happy :)

eleet-2k2 27th December 2004 19:52

Quote:

Originally posted by Juicy2k
Solved it. For some reason winamp wasn't working with SendMessage (just on this one command), so I'm currently using SendNotifyMessage. This does work.

Why SendMessage doesn't work, I don't know. But I have a solution now, so I'm happy :)

Try it with SendMessageA() since it should be sending ASCII (as that's how Winamp wants it). Otherwise, there's something fishy why it's not working.

KJMan 27th December 2004 20:35

I could not get any WM_USER type messages to work using the 'SendMessage' function in VB. I don't know if this is because of the VB IDE or not.
I had to use 'SendMessageTimeout' instead and it worked great.

Juicy2k 27th December 2004 20:44

This may be why SendNotifyMessage works where SendMessage doesn't, since the Notify version returns back to the calling application immediately and places the message on the called application's message queue.

Maybe it's another example of VB being pants.

Don't suppose anyone has any experience of VB.net and winamp?


All times are GMT. The time now is 20:58.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.