Code: Select all
while( GetMessage( &msg, NULL, 0, 0 ) )
{
//some pre-existing stuff goes here?
switch( msg.message )
{
case WM_PAINT: //or whatever
{
// pre-exiting code here, there will be several case blocks
}
// ...more pre-existing code...
case WM_APPCOMMAND: // this is what I'm talking about
{
cmd = GET_APPCOMMAND_LPARAM(msg.lParam);
switch(cmd)
{
case APPCOMMAND_MEDIA_STOP:
{
//call whatever code to stop playback
}
case APPCOMMAND_MEDIA_PLAY_PAUSE:
{
//play or pause the playback depending on current sate
}
case APPCOMMAND_MEDIA_PLAY:
{
//begin playback, do nothing if already playing
}
case APPCOMMAND_MEDIA_PAUSE:
{
//pause playback, do nothing if already paused
}
case APPCOMMAND_VOLUME_DOWN:
{
//lower the playback volume
}
// and so on for all the relevant messages
}
}
Code: Select all
PostMessage(GetForegroundWindow(), WM_APPCOMMAND, (APPCOMMAND_STOP << 16), GetDesktopWindow());
Code: Select all
PostMessage(HWND_BROADCAST, WM_APPCOMMAND, (APPCOMMAND_STOP << 16), GetDesktopWindow());
Code: Select all
vlc.exe --intf qt4
Code: Select all
winEventFilter ( MSG * msg, long * result)
{
switch(msg->message)
{
case WM_APPCOMMAND:
cmd = GET_APPCOMMAND_LPARAM(msg->lParam);
switch(cmd)
{
case APPCOMMAND_MEDIA_STOP:
/*....identify and process the command here...*/
}
*result = TRUE; //The value we want the window procedure to return (Windows expects TRUE here; see WM_APPCOMMAND documentation)
return true; // we don't want Qt to handle this message
default:
return false; // other messages should be handled by Qt
};
}
Return to “VLC media player Feature Requests”
Users browsing this forum: No registered users and 22 guests