Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Videos mit dem Form Animate1.ResName (https://www.delphipraxis.net/101005-videos-mit-dem-form-animate1-resname.html)

taktaky 6. Okt 2007 22:36


Videos mit dem Form Animate1.ResName
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,

kann man den Film steuern, wenn er in diesem Form ist :
Delphi-Quellcode:
implementation

{$R *.dfm}
{$R videos.res}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Animate1.ResName:='test2';
  Animate1.ResHandle:=hinstance;
  Animate1.Active:=true;
end;
Ich möchte Buttons wie Stopp, Pause zu Verfügung machen

Das Problem, wenn ich die Buttons von MediaPlayer1 dazu einfüge, dann werden nicht aktiv !
Der Film läuft aber.

<>

DP-Maintenance 6. Okt 2007 22:39

DP-Maintenance
 
Dieses Thema wurde von "Matze" von "VCL / WinForms / Controls" nach "Multimedia" verschoben.

taktaky 6. Okt 2007 22:57

Re: Videos mit dem Form Animate1.ResName
 
WinSpay konnte mir leider nicht helfen mit seinem Vorschalg :mrgreen:
Delphi-Quellcode:
...
const APPCOMMAND_MEDIA_NEXTTRACK    = $B0000;
  APPCOMMAND_MEDIA_PREVIOUSTRACK = $C0000;
  APPCOMMAND_MEDIA_STOP         = $D0000;
  APPCOMMAND_MEDIA_PLAY_PAUSE   = $E0000;

implementation

{$R *.dfm}
{$R videos.res}

// das Video in Form1 suchen
procedure TForm1.Button4Click(Sender: TObject);
var
  wnd: HWND;
begin
  wnd := FindWindow('TForm1','Form1');
  wnd := FindWindowEx(wnd, 0, 'TAnimate', nil);
if wnd <> 0 then
  Sendmessage(wnd, WM_APPCOMMAND, 0, APPCOMMAND_MEDIA_PLAY_PAUSE)

  else
  ShowMessage('Nicht gefunden'); // diese Meldung wird nicht angezeigt. d.h. das Video wird gefunden aber kann man nicht steuern!!!

end;

Gehstock 6. Okt 2007 23:02

Re: Videos mit dem Form Animate1.ResName
 
Du musst den Buttons vom Mediaplayer auch erstmal sagen was sie tun sollen

taktaky 6. Okt 2007 23:05

Re: Videos mit dem Form Animate1.ResName
 
Zitat:

Zitat von Gehstock
Du musst den Buttons vom Mediaplayer auch erstmal sagen was sie tun sollen

Das ist aber vorprogrammiert oder?
Was soll ich ihm zu tun sagen?

<>

Gehstock 6. Okt 2007 23:15

Re: Videos mit dem Form Animate1.ResName
 
Delphi-Quellcode:
procedure TForm1.maplayerClick(Sender: TObject; Button: TMPBtnType; //all what happens while clicking different mediaplayer buttons
  var DoDefault: Boolean);
begin
dodefault := false;
case button of        // when you click .......

btnext:    // .. "NEXT" button
   begin
         Timer1.Enabled := false;
         ProgressBar1.Position := 0;
         FileListBox1.ItemIndex := fileListBox1.ItemIndex + 1;
         maplayer.EnabledButtons := [btpause,btstop,btPrev,btNext];
         try
            playmp3(true);
         except;
         end;
   end;

btprev:   // .. "PREVIOUS" button
   begin
      Timer1.Enabled := false;
      ProgressBar1.Position := 0;
      FileListBox1.ItemIndex := fileListBox1.ItemIndex - 1;
      maplayer.EnabledButtons := [btpause,btstop,btPrev,btNext];
         try
            playmp3(true);
         except
         end;
   end;

btstop:   // .. "STOP" button
   begin
   Timer1.Enabled := false;
   ProgressBar1.Position := 0;
      try
         maplayer.Stop;
         maplayer.EnabledButtons := [btPlay,btPrev,btNext];
      except
      end;
   end;

btpause:   // .. "PAUSE" button
   begin
      try
         maplayer.EnabledButtons := [btPlay,btstop,btPrev,btNext];
         maplayer.Pause;
         Timer1.Enabled := false;
      except
      end;
   end;

btplay:     // .. "PLAY" button
   begin
    maplayer.EnabledButtons := [btpause,btstop,btPrev,btNext];
    if index_komada = FileListBox1.ItemIndex then
      begin
      if ProgressBar1.Position = 0 then
         begin
            try
               playmp3(true);
               index_komada := FileListBox1.ItemIndex;
            except
            end;
         end
      else
      begin
         try
            maplayer.Play;
            Timer1.Enabled := true;
         except;
         end;
      end;
      end
    else
      try
         playmp3(true);
         index_komada := FileListBox1.ItemIndex;
       except
       end;
    end;
   end;

end;

schonmal die Suchfunktion oder die Hilfe benutzt

taktaky 7. Okt 2007 00:20

Re: Videos mit dem Form Animate1.ResName
 
Liste der Anhänge anzeigen (Anzahl: 1)
was kommt da:
Delphi-Quellcode:
btnext: ???;   // .. "NEXT" button

// wenn einfach so dann geht nicht :
btnext:
begin
...

playmp3(true); // ich habe aber avi und keine mp3
Code:
[Warning] Unit1.pas(7): Unit 'FileCtrl' is specific to a platform
[Error] Unit1.pas(80): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(86): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(88): Undeclared identifier: 'playmp3'
[Error] Unit1.pas(93): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(98): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(111): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(119): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(126): Duplicate case label
[Error] Unit1.pas(128): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(129): Undeclared identifier: 'index_komada'
[Fatal Error] video.dpr(5): Could not compile used unit 'Unit1.pas'

taktaky 7. Okt 2007 00:43

Re: Videos mit dem Form Animate1.ResName
 
Liste der Anhänge anzeigen (Anzahl: 1)
Ich habe einen Code gefunden aber Probleme mit Buttons:
Delphi-Quellcode:
procedure TForm1.MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
                                  var DoDefault: Boolean);

var s : String;
begin
 With MediaPLayer1 do begin
   //Memo1.Lines.Add('Click ' + TranslateButton(Button)+
   //               ' DoDefault:'+IntToStr(Ord(DoDefault)));
   case Button of
     btPlay  : begin
                  EnabledButtons := [btPause, btStop, btNext, btPrev];
                  fClickButton := btPlay;
                  fLastCommand := btPlay;
                end;
     btStop  : begin
                  EnabledButtons := [btPlay, btNext, btPrev];
                  fClickButton := Button;
                  Rewind; // Without Rewind Stop & Pause have the same effect
                end;
     btNext  : begin
                  DoDefault := False;
                  NextSong;
                  PlaySong;
                end;
     btPrev  : begin
                  DoDefault := False;
                  PreviousSong;
                  PlaySong;
                end;
     btPause : begin
                  EnabledButtons := [btPause, btStop, btNext, btPrev];
                  fClickButton := btPlay;
                end;
   end;
   Notify := True;
 End;

end;
Quelle

Code:

[delphi]
[Warning] Unit1.pas(7): Unit 'FileCtrl' is specific to a platform
[Error] Unit1.pas(82): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(83): Undeclared identifier: 'fClickButton'
[Error] Unit1.pas(84): Undeclared identifier: 'fLastCommand'
[Error] Unit1.pas(87): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(91): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(93): Undeclared identifier: 'NextSong'
[Error] Unit1.pas(94): Undeclared identifier: 'PlaySong'
[Error] Unit1.pas(96): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Error] Unit1.pas(98): Undeclared identifier: 'PreviousSong'
[Error] Unit1.pas(102): Incompatible types: 'TMPBtnType' and 'TUDBtnType'
[Fatal Error] video.dpr(5): Could not compile used unit 'Unit1.pas'
Das Problem ist nicht was die Buttons tun, sondern wie man die Buttons aktiv macht :mrgreen: !
Delphi-Quellcode:
MediaPlayer1.EnabledButtons := [btpause,btstop,btPrev,btNext]; // Hilft leider nicht

Gehstock 7. Okt 2007 08:53

Re: Videos mit dem Form Animate1.ResName
 
zu verstehen was der Code macht dann hättest du gemerkt das da was fehlt
sollen wir dir das komplette Programm vorkauen

Delphi-Quellcode:
procedure TForm10.MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
  var DoDefault: Boolean);
var s : String;
begin
With MediaPLayer1 do begin
   case Button of
     btPlay  : begin
                  EnabledButtons := [btPause, btStop, btNext, btPrev];
                  Play;
                end;
     btStop  : begin
                  EnabledButtons := [btPlay, btNext, btPrev];
                  Stop;
                end;
     btNext  : begin
                  DoDefault := False;
                  Next;
                  Play;
                end;
     btPrev  : begin
                  DoDefault := False;
                  Previous;
                  Play;
                end;
     btPause : begin
                  EnabledButtons := [btPause, btStop, btNext, btPrev];
                  Pause;
                end;
   end;
end;
end;
die Buttons werden nur Enabled wenn du eine datei zugewiesen hast

mit
Delphi-Quellcode:
MediaPLayer1.FileName := 'test.wav';

taktaky 7. Okt 2007 12:20

Re: Videos mit dem Form Animate1.ResName
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,

Du hast bestimmt das Bild von meinem letzten Problem nicht angeschaut :wink:

Das Problem: Die Buttons bleiben deaktiviert:
http://www.delphipraxis.net/download.php?id=29304

Oder nur wenn das Video in einem anderen Form eingebaut wird?


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:12 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz