Einzelnen Beitrag anzeigen

ASM

Registriert seit: 16. Aug 2004
165 Beiträge
 
Delphi 7 Enterprise
 
#2

AW: Rückgabewert für Message WM_APPCOMMAND

  Alt 10. Mai 2012, 16:35
Wisst ihr wie das geht?
Gemeint ist die Variable handled

Code:
procedure TForm1.WndProc(var Message: TMessage);
const
  WM_APPCOMMAND = $319;
  WM_APPCOMMAND_MEDIA_NEXTTRACK = 11; //Go to next track.
  WM_APPCOMMAND_MEDIA_PREVIOUSTRACK = 12; //Go to previous track.
  WM_APPCOMMAND_MEDIA_STOP = 13; //Stop playback.
  WM_APPCOMMAND_MEDIA_PLAY_PAUSE = 14; //Play or pause playback.
var
  Handled: boolean;
begin
  with Message do
  begin
    if (Msg = WM_APPCOMMAND) then
    begin
      case (LParamHi and $FFF) of
        WM_APPCOMMAND_MEDIA_STOP:
          begin
            frmNowPlaying.Stop();
            Handled := TRUE;
          end;
        WM_APPCOMMAND_MEDIA_PLAY_PAUSE:
          begin
            if FPlayerStatus = psPlay then
              frmNowPlaying.Pause()
            else
              frmNowPlaying.Play();
            Handled := TRUE;
          end;
        WM_APPCOMMAND_MEDIA_PREVIOUSTRACK:
          begin
            frmNowPlaying.Previous();
            Handled := TRUE;
          end;
        WM_APPCOMMAND_MEDIA_NEXTTRACK:
          begin
            frmNowPlaying.Next();
            Handled := TRUE;
          end;
      else
        { Unknown command - not handled here }
        Handled := FALSE;
      end;
      Result := LongInt(Handled);
    end
    else
      { Not WM_APPCOMMAND - we're not interested }
      inherited;
  end;
end;
Weitere Einzelheiten dazu gab es hier. Leider aber seit einiger Zeit off.
  Mit Zitat antworten Zitat