Autor Beitrag
spike0
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77



BeitragVerfasst: Sa 29.10.05 19:13 
Ich habe ein Editor (TSynEdit, oder auch ein normales TMemo). Jetzt möchte ich das, was ich in dem Editor drin stehen habe, mit dem Delphi Compiler compilieren und anschließend diese Datei öffnen.
Bisjetzt habe ich das so gemacht:
1. Im Ordner mit meinem Programm einen neuen Ordner erstellt (mit dem Namen Ordner) und dort ein neues Projekt erstellt und gespeichert.
2.:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var path,files:string;
f:textfile;
begin
files:=aaa+'Delphi\Unit1.pas'; //variable aaa beinhaltet den Pfad zu meinem Programm
path:='C:\Programme\Borland\Delphi7\Bin\dcc32.exe'; //Pfad zum Delphi-Compiler
assignFile(f,files);
rewrite(f);
writeln(f,Editor.Text);
closefile(f);
// --> Unit1 besteht jetzt aus dem text asu dem Editor
shellexecute(handle,'open',pchar(path),pchar(files),nil,sw_normal); // Unit1 compilieren
shellexecute(handle,'open',pchar(path),pchar(aaa+'delphi\Project1.dpr'),nil,sw_normal); //das ganze Projekt compilieren
shellexecute(handle,'open',pchar(aaa+'delphi\project1.exe'),nil,nil,sw_normal); // die Datei öffnen


Nun das Problem: Die Unit1 wird verändert, so wie es sein soll. Aber es wird nicht richtig kompiliert, das Programm öffnet sich mit der alten Datei (also Unit1 vor der Veränderung).

Wo liegt der Fehler?

Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 29.10.05 21:39 
1. sollte dein Source Delphi-Tags verwenden ...
2. würde ich Dir die Verwendung des /B-Paramters beim Aufruf des DCC32 empfehlen.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
spike0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77



BeitragVerfasst: Sa 29.10.05 21:48 
1. Was sind delphi tags?
2. wie soll ich das aufrufen? so hier?

shellexecute(handle,'open',pchar(path),pchar(files),pchar('/B'),sw_normal);
shellexecute(handle,'open',pchar(path),pchar(aaa+'delphi\Project1.dpr'),pchar('/B'),sw_normal);
spike0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77



BeitragVerfasst: Sa 29.10.05 21:58 
3. es funktioniert nicht
4. das merkwürdige:
ich öffne die cmd.exe und gebe das hier ein:
C:\Dokumente und Einstellungen\Darek>C:\Programme\Borland\Delphi7\Bin\dcc32.exe
C:\Programme\Borland\Delphi7\Projects\CloseGL\Delphi\Project1.dpr

und es klappt!
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 29.10.05 22:01 
1. [delphi.][/delphi.] <- Das sind Delphi-Tags.
2. Würdest du mal gescheit formatieren und uns z.B. sagen was 'aaa' ist, würden wir vielleicht schneller den Fehler finden.


PS: Es gibt auch einen Edit-Button. Musst nicht extra einen neuen Post aufmachen.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
spike0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77



BeitragVerfasst: Sa 29.10.05 22:04 
das steht doch in dem Quelltext: aaa beinhaltet den Pfad zu meinem Programm, und dass ist hier: "C:\Programme\Borland\Delphi7\Projects\CloseGL\"
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 29.10.05 22:09 
user profile iconspike0 hat folgendes geschrieben:
1. Was sind delphi tags?

Siehe GTA's Post ;-)

user profile iconspike0 hat folgendes geschrieben:
2. wie soll ich das aufrufen? so hier?

Anstatt
user profile iconspike0 hat folgendes geschrieben:
shellexecute(handle,'open',pchar(path),pchar(files),pchar('/B'),sw_normal);
shellexecute(handle,'open',pchar(path),pchar(aaa+'delphi\Project1.dpr'),pchar('/B'),sw_normal);

Wäre hier die Verwendung der Delphi-Tags hier wieder sinnvollgewesen und könnte dann so hier
ausblenden Delphi-Quelltext
1:
2:
shellexecute(handle,'open',pchar(path),pchar('/B ' + files),'open',sw_normal);
shellexecute(handle,'open',pchar(path),pchar('/B ' +aaa+'delphi\Project1.dpr'),'open',sw_normal);

aussehen.

user profile iconspike0 hat folgendes geschrieben:
3. es funktioniert nicht

Sehr informativ diese aussage ... Entspricht dem ersten Teil meiner Signatur ;-)

user profile iconspike0 hat folgendes geschrieben:
4. das merkwürdige:
ich öffne die cmd.exe und gebe das hier ein:
C:\Dokumente und Einstellungen\Darek>C:\Programme\Borland\Delphi7\Bin\dcc32.exe
C:\Programme\Borland\Delphi7\Projects\CloseGL\Delphi\Project1.dpr

und es klappt!

Wenn man PChars schon falsch übergibt, kann es nicht funktionieren ...

user profile iconGTA-Place hat folgendes geschrieben:
1. [delphi.][/delphi.] <- Das sind Delphi-Tags.

Endlich jemand, der zumindest die Grundlagen kennt :mrgreen:

user profile iconGTA-Place hat folgendes geschrieben:
2. Würdest du mal gescheit formatieren und uns z.B. sagen was 'aaa' ist, würden wir vielleicht schneller den Fehler finden.
Als ich weiß nur, das der aktuelle Source AA ist, woher er das dritte A nimmt, weiß ich nicht ... ;-)

user profile iconGTA-Place hat folgendes geschrieben:
PS: Es gibt auch einen Edit-Button. Musst nicht extra einen neuen Post aufmachen.

Jup. Hab schon überlegt, ob ich ihm das auch noch erklär ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 29.10.05 22:12 
user profile iconspike0 hat folgendes geschrieben:
das steht doch in dem Quelltext: aaa beinhaltet den Pfad zu meinem Programm, und dass ist hier: "C:\Programme\Borland\Delphi7\Projects\CloseGL\"

Du hast das aber nicht etwa so (oder so Ähnlich) gemacht?:
ausblenden Delphi-Quelltext
1:
2:
var
  aaa: String = 'C:\Programme\Borland\Delphi7\Projects\CloseGL\';

Da werden sich alle freuen, die das Programm nicht in dem Ordner haben...

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: So 30.10.05 10:42 
Ich füge mal die Verknüpfung zum DP-Thread ein.

_________________
Ist Zeit wirklich Geld?
spike0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 77



BeitragVerfasst: So 30.10.05 20:26 
Zitat:

Du hast das aber nicht etwa so (oder so Ähnlich) gemacht?:
var aaa: String = 'C:\Programme\Borland\Delphi7\Projects\CloseGL\';
Da werden sich alle freuen, die das Programm nicht in dem Ordner haben...


Also so ein Anfänger bin ich auch mal wieder nicht ;)

Ich habe nach 2 Stunden das Problem gelöst: ich muss zwischen den einzelnen Shellexecute Prozeduren Pausen machen (application.processmessages). Da hätte ich auch gleich ne Frage, ich hab diese Funktion mit dem Parameter Atime:=1000 aufgerufen - eine Sekunde reicht locker, um ein kleines Programm zu kompilieren:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure DDelay(ATime:Integer);
var Start : Integer;
begin
  Start:=GetTickCount;
  repeat
    Application.ProcessMessages;
  until GetTickCount-Start > ATime;
end;


Was ist aber, wenn das Programm richtig lang ist? Könnte sein, dass durch "application.processmessages" das Programm so lange angehalten wird, bis die Kompilation fertig ist?
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 30.10.05 21:39 
Für das Warten auf einen anderen Prozess würd ich dich an die Foren-Such-Funktion oder das SwissDelphiCenter verweisen. Dort gibt's mehr als genug Informationen zu diesem Thema "auf anderes Programm warten" ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.