topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday March 18, 2024, 9:14 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: playback status from Win API SendMessage  (Read 14694 times)

AEN007

  • Participant
  • Joined in 2011
  • *
  • Posts: 74
  • Imagination is more important than knowledge
    • View Profile
    • Donate to Member
playback status from Win API SendMessage
« on: December 19, 2011, 05:22 AM »
19December2011
SendMessage to WinAmp (or players that support WinAmp APIs like Trout)
to determine playback status (playing/paused/stopped) is»
Code: Autohotkey [Select]
  1. SendMessage, 0x400, 0, 104, , ahk_class Winamp v1.x
I would like to know the SM syntax for players (like CoolPlayer)
that use Windows APIs instead of WinAmp APIs ...

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #1 on: December 19, 2011, 08:46 AM »
You'll have to look at each individual player you want to support.

If you're lucky, they'll have a well-defined open interface, either through SendMessage or proprietary plugins. If you're not lucky, you'll have to do a bit of reverse engineering to find out control IDs... and if it's something with a really custom skinned GUI, you might not be able to SendMessage at all.
- carpe noctem

AEN007

  • Participant
  • Joined in 2011
  • *
  • Posts: 74
  • Imagination is more important than knowledge
    • View Profile
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #2 on: December 19, 2011, 10:06 AM »
19December2011
Greetings.
Thanks for the reply.
Today I found the following statement about CoolPlayer»
A: It's written in 'C' and plain Windows API's
Wouldn't all/any players that use Windows API's reply to the same syntax?
Anyway, I have no idea how to go about this.
What might be some standard syntax possibilities to try?
Any helpful replies/insights appreciated.
Thank you.
Regards

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #3 on: December 19, 2011, 10:10 AM »
Wouldn't all/any players that use Windows API's reply to the same syntax?
Nope :)

What "plain Windows APIs" means in this context is that instead of using a big set of GUI and class libraries, the application uses relatively low-level functions to do it's work. This is more work for the developer, but results in smaller and (sometimes) faster executables.

Unfortunately, it doesn't mean that there's a standard Windows API for controlling arbitrary media players.
- carpe noctem

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #4 on: December 19, 2011, 11:02 AM »
As f0dder says, there is no standard for this sort of thing.  It's up to the developer to write in support for particular window messages (if any).  I became quite familiar with this sort of thing when writing my MPH application.  Only a few of the supported players I made work have any sort of API built-in.  At any rate, CoolPlayer was one of them and its messages are as follows:

Play: 40010
Pause: 40012
Stop: 40011
Prev: 40015
Next: 40014
Vol up: 40016
Vol down: 40017
Vol mute: 50000

AEN007

  • Participant
  • Joined in 2011
  • *
  • Posts: 74
  • Imagination is more important than knowledge
    • View Profile
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #5 on: December 19, 2011, 02:48 PM »
19December2011
Wow ... I hit the jackpot by posting here ...
My interest in messaging CoolPlayer is mostly just to resolve a long standing "open item" of mine ...
how to determine CP playback status in a script because the GUI gives NO indication at all ...
CP uses the least CPU usage of any mp3 player I have encountered, but
I phased CP out of usage because of the no playback indication issue.
I have no real need/desire to put CP into my rotation of multimedia players ...
but it would/will be nice to have resolved this long standing open item ...

I need to ask/clarify something further.
I use the following items»
Code: Autohotkey [Select]
  1. SendMessage, 0x400, 0, 104, , ahk_class COWON Jet-Audio MainWnd Class
  2. SendMessage, 0x400, 0, 104, , - Trout ahk_class Winamp v1.x
  3. SendMessage, 0x400, 0, 104, , ahk_class Winamp v1.x
  4. SendMessage, 0x400, 0, 104, , ahk_class XMPLAY-MAIN
The AHK ErrorLevel is 0 when stopped, 1 when playing & 3 when paused.
The only thing that changes is the name of the receiving window.

It is (still) not (immediately) clear to me what syntax I should use with CoolPlayer.

Because I often use MPlayer (on my PII) for avi playback,
I would REALLY like to crack the SendMessage format for MPlayer ...

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #6 on: December 19, 2011, 03:08 PM »
[quote author=AEN007 link=topic=29339.msg272003#msg272003 date=1324327739]
The AHK ErrorLevel is 0 when stopped, 1 when playing & 3 when paused.
The only thing that changes is the name of the receiving window.

It is (still) not (immediately) clear to me what syntax I should use with CoolPlayer.
[/quote]

It's probably likely that CoolPlayer doesn't offer that sort of thing (playing status indication).  Were you able to get the other messages I posted to work?

AEN007

  • Participant
  • Joined in 2011
  • *
  • Posts: 74
  • Imagination is more important than knowledge
    • View Profile
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #7 on: December 19, 2011, 03:44 PM »
No ... I have not tried
because
1) that is not what I am after ...
I would like to determine with a script whether CP is playing/paused/stopped.
2) CP (unlike Trout) responds to local hotkeys sent by an AHK script.
The CP local hotkeys are the same as WinAmp's ...
and like WA's they are hardcoded and non customizable ...
Code: Autohotkey [Select]
  1. WinActivate, ahk_class CoolPlayer
starts playback ... I guess like the 40010 would ...
3) I do not know the full syntax in any case.
I guess any of those CP codes would replace the 0x400? like ...
Code: Autohotkey [Select]
  1. SendMessage, 0x40010, ?, ?, , ahk_class CoolPlayer
What would be the correct syntax in any case?

I would guess it is certainly possible to use SendMessage with CP & MPlayer
to determine playback status. I hope to find out how ...

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #8 on: December 19, 2011, 03:52 PM »
3) I do not know the full syntax in any case.
I guess any of those CP codes would replace the 0x400? like ...
Code: Autohotkey [Select]
  1. SendMessage, 0x40010, ?, ?, , ahk_class CoolPlayer
What would be the correct syntax in any case?

Correct syntax would be:
Code: Autohotkey [Select]
  1. SendMessage, 0x0111, 40010, 40010, , ahk_class CoolPlayer ; 0x0111 is WM_COMMAND

I would guess it is certainly possible to use SendMessage with CP & MPlayer
to determine playback status. I hope to find out how ...

Well, if the code isn't in the application to begin with, you're not going have much luck.  Another tip: most (all?) cross-platform apps like MPlayer will NOT have any sort of Windows API message handling built-in.  You'll have to find other ways to control it...sending keys, commandline switches, etc.



AEN007

  • Participant
  • Joined in 2011
  • *
  • Posts: 74
  • Imagination is more important than knowledge
    • View Profile
    • Donate to Member
Re: playback status from Win API SendMessage
« Reply #9 on: December 19, 2011, 04:11 PM »
Well, the XMP GUI (like the CP GUI) gives no indications of playback status
and unlike the Trout/foobar GUIs cannot be tweaked with user formatting to do so;
but XMP responds to the WA APIs, so that is what started me on the SendMessage path ...

Controlling CP & MPlayer has not been the issue except that it is / has been impossible
to determine with a script whether either is playing or was actually paused
by the script command to pause the app ...

Today I also read here» CP
6: I would like to write a remote control for CoolPlayer, how can I do this?

A: It's possible to send Accelerators to the main CoolPlayer window for all playing controls.
If you send me an e-mail I will send you the messages.
I sent an email but do not know if I will ever receive a reply or not ...

Well, I hope to find some way to determine with a script the MPlayer playback status