Old 15th July 2010, 09:27   #1
Chahine
Junior Member
 
Join Date: Jul 2010
Posts: 6
Button pressed events triggered late

Hi all,

I'm running into a very annoying problem : I'm catching the events "Next button pressed" and "Previous button pressed" using the following code into the WndProc function :

code:
if (message = WM_COMMAND) {
// Previous button pressed
if (LOWORD(wParam) == WINAMP_BUTTON_PREV) {
// Processing
}

// Next button pressed
else if (LOWORD(wParam) == WINAMP_BUTTON_NEXT) {
// Processing
}
}



By so, I noticed that those events were triggered only AFTER the new song has started to be played, which is not what I want. Indeed, I would like to use an algorithm to select the next played song each time the user skips the current song, I then don't want a new song to start before my algorithm has run.

Is there a way to achieve this ?

Thanks a lot.
Chahine is offline   Reply With Quote
Old 21st July 2010, 09:28   #2
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
First of all how are you subclassing winamp? I'd suggest you use Windows Hook.
griffins_Grader is offline   Reply With Quote
Old 23rd July 2010, 13:47   #3
DrO
 
Join Date: Sep 2003
Posts: 27,873
Quote:
Originally Posted by griffins_Grader View Post
I'd suggest you use Windows Hook.
i really hope you're not suggesting the usage of SetWindowsHookEx and its related family of functions - that is just inappropriate and will cause more issues than it's worth.

doing a standard subclass via SetWindowLongPtr(GWLP_WNDPROC) is the recommended way to do it (or via the SubClass function in the OS on supporting clients).

@Chahine: most likely you need to process the message before you do CallWindowProc(..) since that should then mean you're processing before the native plug-ins / Winamp core does what is needed. however there are better methods to override the next track to play (either api_queue or if that is not present then IPC_GET_NEXT_PLITEM / IPC_GET_PREVIOUS_PLITEM (is only safe to use these directly if gen_jumpex.dll is not present as that implements the api_queue interface to wrap / control those messageS).

-daz
DrO is offline   Reply With Quote
Old 26th July 2010, 11:14   #4
Chahine
Junior Member
 
Join Date: Jul 2010
Posts: 6
Since I have gen_jumpex.dll, I guess I must use api_queue. But where is api_queue.h ? I can't find it in the SDK, and this (old) post suggests it is not there. Is the version you put in this post up-to-date ?
Chahine is offline   Reply With Quote
Old 29th July 2010, 13:41   #5
DrO
 
Join Date: Sep 2003
Posts: 27,873
i've attached v1.0.1 of the header file (it is set to be shipped in the sdk but i've no idea if/when an updated version of it will ever be released unless i've missed it - had thought it had been rolled out but i guess not *shrugs* ).

-daz
Attached Files
File Type: h api_queue.h (6.3 KB, 254 views)
DrO is offline   Reply With Quote
Old 21st August 2010, 14:36   #6
Chahine
Junior Member
 
Join Date: Jul 2010
Posts: 6
I managed to do the job. Thank you for your help !
Chahine 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