Autor Beitrag
Bergmann89
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: So 30.04.06 13:29 
Hi,

ich wollte meinem Kumpel einen Timer baun, der den Computer nach ner bestimmten Zeit ausschaltet. Dazu hab'sch mir ne *.bat gemacht und wollte die dann von dem Proggramm starten lassen, das geht aber nicht. Er findet keinen Fehler wenn ich das compile aber er führt den Befehl auch nicht aus !

Quelltext sieht ungefähr so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
var open: PAnsiChar;
begin
  ShellExecute(Application.Handle,open,'aus_s.bat',nil,nil,SW_MINIMIZE);
end;

Hab auch nochma das Prog hochgeladen.
Wäre nett wenn ihr mir da helfen könntet !

MfG BErgmann


Moderiert von user profile iconChristian S.: Topic aus VCL (Visual Component Library) verschoben am Mo 01.05.2006 um 19:36
Moderiert von user profile iconNarses: Überflüssige Zeilenumbrüche/Leerzeilen entfernt.
Moderiert von user profile iconNarses: Anhang wegen Virenbefall gelöscht.
Levier
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 24



BeitragVerfasst: So 30.04.06 14:02 
Versuchs mal mit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
var open: PAnsiChar;
begin
  ShellExecute(Application.Handle,'open','aus_s.bat',nil,nil,SW_MINIMIZE);
end;
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: So 30.04.06 14:15 
Jep, funzt.

Thx Bergmann.
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Mo 01.05.06 19:11 
So hab das jetzt alles so wie ich wollte.
und bloß noch ein Problem:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShellExecute(Application.Handle,'open', OpenDialog1.FileName,nil,nil,SW_MINIMIZE);
end;


Und zwar will ich ds der die Datei aus dem OpenDialog1 öffnen, weiß aber nicht wie, da kommt ein fehler.

MfG Bergmann
Levier
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 24



BeitragVerfasst: Di 02.05.06 16:18 
so sollte es funktionieren:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShellExecute(Application.Handle,'open',PChar(OpenDialog1.FileName),nil,nil,SW_MINIMIZE);
end;
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Mi 03.05.06 09:58 
Jo, danke.

Geht eins-a.

MfG Bergmann.
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Do 04.05.06 17:53 
Titel: ?
Warum hat denn der Compiler keine Meldung ausgegeben, als du

ausblenden Delphi-Quelltext
1:
  ShellExecute(Application.Handle,open,'aus_s.bat',nil,nil,SW_MINIMIZE);					


eingegeben hast? Eigentlich müsste doch "undefinierter bezeichner" kommen, wegen dem "Open". Oder war "Open" ein string oder PChar?

Bloß aus Interesse!
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 04.05.06 19:05 
Titel: Re: ?
user profile iconbokaj hat folgendes geschrieben:
Warum hat denn der Compiler keine Meldung ausgegeben, als du

ausblenden Delphi-Quelltext
1:
  ShellExecute(Application.Handle,open,'aus_s.bat',nil,nil,SW_MINIMIZE);					


eingegeben hast? Eigentlich müsste doch "undefinierter bezeichner" kommen, wegen dem "Open". Oder war "Open" ein string oder PChar?

Bloß aus Interesse!


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
var open: PAnsiChar;
begin
  ShellExecute(Application.Handle,open,'aus_s.bat',nil,nil,SW_MINIMIZE);
end;


P.S.: Eigentlich sollte die ganze Zeile gehighlightet werden, is wohl n Bug

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.