Autor Beitrag
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 11.07.09 04:32 
- Nachträglich durch die Entwickler-Ecke gelöscht -
turboPASCAL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP / Vischda
D6 PE / D2005 PE
BeitragVerfasst: Sa 11.07.09 06:17 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Mediaplayer1.Visible := false;
  Mediaplayer1.AutoEnable := false;
  Mediaplayer1.FileName := ('C:\....\.wmv');
  Mediaplayer1.Open;
  Mediaplayer1.Play;
  Mediaplayer1.Display := Panel1;
  Form1.Close;
  Form2.show; // auf die Uses Klausel wurde nicht vergessen 
end;


Form1.Close beendet das Programm, mach daraus mal ein Form1.Hide.

_________________
Nein, ich bin nicht der turboPASCAL aus der DP, ich seh nur so aus... :P
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 11.07.09 06:38 
- Nachträglich durch die Entwickler-Ecke gelöscht -
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 11.07.09 09:29 
Wie wäre es mit dem Event OnNotify?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 11.07.09 09:34 
user profile iconFrühlingsrolle hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.FormCreate(Sender: TObject);
begin
// ...
  Form1.Close;
// ...
end;

Du baust da grade ein Auto und möchtest es während des Bauens direkt verschrotten. Das kann nicht funktionieren, auch nicht mit Abwrackprämie.

OnNotify sollte das richtige für dich sein. Eventuell hilft auch der "Mediaplayer für Dummies", das ist ein Tutorial zu dem TMediaPlayer hier im Forum.

_________________
We are, we were and will not be.
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 11.07.09 11:29 
- Nachträglich durch die Entwickler-Ecke gelöscht -
turboPASCAL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP / Vischda
D6 PE / D2005 PE
BeitragVerfasst: Sa 11.07.09 16:46 
ausblenden Delphi-Quelltext
1:
Form1.Close;					

War meine Idee. Hatte übersehen das es sich um FormCreate handelt.

So klappts doch wohl:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
type
  TForm1 = class(TForm)
    MediaPlayer1: TMediaPlayer;
    Panel1: TPanel;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private-Deklarationen }
    procedure OnMediaPlayerNotify(Sender: TObject);
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Mediaplayer1.Visible := false;
  Mediaplayer1.AutoEnable := false;
  Mediaplayer1.FileName := 'C:\....\.wmv';
  Mediaplayer1.Open;
  Mediaplayer1.Display := Panel1;
  Mediaplayer1.OnNotify := OnMediaPlayerNotify;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  Mediaplayer1.Play;
end;

procedure TForm1.OnMediaPlayerNotify(Sender: TObject);
begin
  if ((Mediaplayer1.Position > 0 ) and
    (Mediaplayer1.Position >= Mediaplayer1.Length)) or
    (Mediaplayer1.Mode = mpStopped) then
  begin
    Form1.Hide;
    Form2.Show;
    Form2.BringToFront;
  end;
end;

end.
Einloggen, um Attachments anzusehen!
_________________
Nein, ich bin nicht der turboPASCAL aus der DP, ich seh nur so aus... :P


Zuletzt bearbeitet von turboPASCAL am Sa 11.07.09 17:21, insgesamt 1-mal bearbeitet
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 11.07.09 16:51 
Das Open würde ich erst nach dem Setzen der Eigenschaften, insbesondere von Display, machen. :-)

Zudem ist OnActivate :shock: ja nicht besonders sinnvoll, schließlich wird es jedesmal ausgeführt, wenn das Formular den Eingabefokus bekommt. Wie wäre es mit OnShow zum Beispiel?
turboPASCAL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP / Vischda
D6 PE / D2005 PE
BeitragVerfasst: Sa 11.07.09 17:25 
Zitat:
Zudem ist OnActivate ...
In der Tat, habe es auf OnShow gesetzt.
K.A. warum ich darauf gekommen war.

Zitat:
Das Open würde ich erst nach dem Setzen der Eigenschaften, insbesondere von Display, machen.

Ich kenne mich mit dem Mediaplaydings nicht besonders aus. Warum würdest du das machen ?

_________________
Nein, ich bin nicht der turboPASCAL aus der DP, ich seh nur so aus... :P
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 11.07.09 17:43 
user profile iconturboPASCAL hat folgendes geschrieben Zum zitierten Posting springen:
Ich kenne mich mit dem Mediaplaydings nicht besonders aus. Warum würdest du das machen ?
Weil bereits beim Öffnen das erste Bild des Videos auf dem Panel angezeigt wird soweit ich mich entsinne. Beim Abspielen dann wird es dann weiter abgespielt.
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 11.07.09 20:17 
- Nachträglich durch die Entwickler-Ecke gelöscht -
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: So 12.07.09 15:31 
Also ich würde dann das doch eher in der Form2.OnClose(*Parameter*)-Prozedur machen...
Dann könntest Du ja zum Beispiel auch das X oben rechts nutzen!

...und dann weiß ich immer nicht so ganz, ob ich das hier so offen kundgeben darf, oder ob das dann wieder einige zu schlechten Abwegen verleitet:
Application.Terminate(); beendet auf jeden Fall das gesamte Programm! - Ohne Nachfrage!...
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 12.07.09 17:26 
- Nachträglich durch die Entwickler-Ecke gelöscht -
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: So 12.07.09 17:44 
Also da würde ich es doch mal mit dieser Variante versuchen ("geräubert" aus Thread 91246 und 90186):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if messageBox(handle,'Möchten Sie das Programm wirklich schließen?','Wirklich beenden?',MB_YESNO)=IDNO then
    Action := caNone;
end;

Oder? - Ist das keine praktikable Lösung für Dich?

- Oder ist dieses Thema jetzt doch schon komplett für Dich erledigt?
Dann wäre es doch schön, wenn Du uns noch Deine Lösung hier reinschreiben könntest und das Thema so markierst.

Edit: Hmmm - wo ich jetzt gerade noch mal das gesamte Thema überfliege, habe ich wohl jetzt gerade Dein Problem nicht mehr so ganz richtig im Kopf...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 12.07.09 18:13 
user profile iconffgorcky hat folgendes geschrieben Zum zitierten Posting springen:
Also da würde ich es doch mal mit dieser Variante versuchen [...]
Das passiert ja schon richtigerweise in OnCloseQuery. OnClose ist dafür der falsche Ort, da da das Schließen bereits stattfinden soll. ;-)
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 12.07.09 20:10 
- Nachträglich durch die Entwickler-Ecke gelöscht -