Autor Beitrag
g1o2k4
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 493



BeitragVerfasst: Mo 17.01.05 16:48 
hi
ich hab ein problem und zwar wollte ich das wenn ein timer abgelaufen ist eine *.exe gestartet wird, aber ich weiß den code nicht kann mit jemand helfen ???

mein timer sieht so aus:
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:
51:
52:
53:
54:
55:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

  var
  Form1: TForm1;
  Zahl: integer;
implementation

{$R *.dfm}
 
procedure TForm1.FormCreate(Sender: TObject);  
begin
timer1.enabled:=false;
end;  

 
procedure TForm1.Button1Click(Sender: TObject);  
begin  
Zahl:=strtoint(edit1.Text);  
timer1.enabled:=true;  
end;  


procedure TForm1.Timer1Timer(Sender: TObject);  
begin  
Zahl:=Zahl-1;
label1.caption:='Nur noch: '+inttostr(Zahl);
if Zahl=0 then showmessage(edit1.text+' Sekunden sind vergangen!Countdown beendet!');  
end;  

 
end.

end.


kann mit einer sagen wie der code lautet um eine beliebige exe starten zu lassen ???

thx mfg g1o



Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 17.01.05 16:52 
Suche in: Delphi-Forum, Delphi-Library SHELLEXECUTE ist genau das, was du suchst.
g1o2k4 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 493



BeitragVerfasst: Mo 17.01.05 18:04 
hi kannste mir das mal als beispiel unten hinscreiben ? ich check das nicht...
nenn die exe beispiel.exe und sag wo die hin muss damit das programm das findet usw !
snoopyonline
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Mo 17.01.05 18:47 
Ein möglichst variables Beispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Uses ... Shellapi ...;


procedure Tform1.Button1.Click(Sender: TObject);
var parameter, programm : string;
begin

programm := 'c:\Verzeichnis\beispiel.exe'; {Kann auch ne Word-, HTML- oder sonst eine Datei sein - wird dann mit dem entsprechend verknüpften Programm geöffnet}
parameter := 'C:\test\bild.jpg'; {Wenn gewünscht kann man auch Parameter übergeben - beispielsweise ine zu öffnendes Bild - ansonsten parameter:='';}
ShellExecute(handle,'open',pchar(programm),pchar(parameter),'',SW_SHOWNORMAL);
end;


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.