Autor Beitrag
fcg
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Fr 13.06.03 23:51 
hi

ich habe nur eine .dpr datei, die ich kompilieren will (ohne Units und Forms). nun läuft das auch alles, aber die Anwendung schließt sich direkt wieder. Wie kann ich das vermeiden, das die anwendung aktiv bleibt, und erst z.B auf mausklick beendet wird?

thÄnXx

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 14.06.03 00:13 
Und wohin soll der Mausklick gehen, wenn du kein Formular hast?

_________________
Ist Zeit wirklich Geld?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 14.06.03 05:01 
Zeig mal die dpr-Datei.
fcg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Sa 14.06.03 12:53 
so sied es aus

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
program Project1;

uses
  Windows, Forms;

var
 h : TForm;

begin
 h := TForm.Create(nil);
 h.Show;
end.


für ne halb sekunde erscheint jetzt die Form, die ich nur zum Beispiel erzeugt habe...

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 14.06.03 13:13 
fcg hat folgendes geschrieben:
ohne Units und Forms
´
Und was ist das:
Zitat:
h := TForm.Create(nil);
h.Show;

Äpfel und Birnen etwa?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
program Project1; 

uses 
  Windows, Forms; 

var 
 h : TForm; 

begin 
  Application.Initialize;
  h := TForm.Create(nil); 
  h.Show; 
  Appliation.Run; // Message Loop starten
end.

_________________
Ist Zeit wirklich Geld?
fcg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Sa 14.06.03 13:19 
hi

das da oben sollte uhne Units mit Formen) heißen. Also keie Extra Units, wolte ich damit sagen... :oops:

Aber mit deinem Code hat sich nichts veändert. Prog beendet sich wieder sofort nach dem Compillieren...

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 14.06.03 13:23 
Kleine Verbesserung:
ausblenden Delphi-Quelltext
1:
2:
3:
  Application.Initialize; 
  Application.CreateForm(h, TForm);  
  Appliation.Run; // Message Loop starten

_________________
Ist Zeit wirklich Geld?
fcg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Sa 14.06.03 13:28 
yo danke. jetzt funzt es!!

Die Paramter bie CreateForm sind aber andersrum ;-)

noch eine letzte frage. Wie mache ich das jetzt wenn ich wirklich keine Form haben will, sondern das das Prog jetzt wirklich nur im Hintergrund laufen soll. Es soll aktiv sein, aber ohne Form, geht das auch??

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Sa 14.06.03 13:48 
fcg hat folgendes geschrieben:
Die Paramter bie CreateForm sind aber andersrum ;-)

Copy&Paste Sperre :D


Zitat:
Wie mache ich das jetzt wenn ich wirklich keine Form haben will, sondern das das Prog jetzt wirklich nur im Hintergrund laufen soll. Es soll aktiv sein, aber ohne Form, geht das auch??

Sowas nennt sich dann Systemdienst und dafür gibt es (ab der Professional Version) ensprechende Komponenten.

Eine andere Möglichkeit besteht in einem Versteckten Formular (am besten gleich direkte WinAPI Nutzung) und einer Messageloop.

_________________
Ist Zeit wirklich Geld?
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Sa 14.06.03 13:55 
Also, grob gesgt gibt es mehrere Möglichkeiten ein Programm zu behandeln:

- Ein standard Delphiprogramm mit Formularen. Maus- und Tastatureingaben werden von den jeweiligen aktiven Formularen abgearbeitet.

- Ein Konsolenprogramm mit Eingabe und Ausgabe über ein Konsolenfenster. Das Programm steht in der DPR Datei (weitere Units sind möglich, aber nicht notwendig)

- Ein reines Pascalprogramm, jedoch kein Konsolenprogramm. Ein- und Ausgaben (Maus, Tastatur, Monitor) sind nicht möglich. Man kann aber natürlich auf Dateien oder sonstiges (z.B. OLE Automation) zugreifen.

- Ein NonVcl Programm. Auch ein reines Pascalprogramm, aber mit etwas mehr Möglichkeiten. Es wird eine Schleife erstellt die Messages empfängt und abarbeitet. Formulare mit Objekten können erstellt werden, müssen aber nicht (meiner Kenntnis nach).

_________________
Popov
fcg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Sa 14.06.03 14:04 
Popov hat folgendes geschrieben:

- Ein Konsolenprogramm mit Eingabe und Ausgabe über ein Konsolenfenster. Das Programm steht in der DPR Datei (weitere Units sind möglich, aber nicht notwendig)


Hatte an sowasglaube ich dann gedacht. Wie mache ich das dann, das das Prog im bg weiter arbeitet..??

Gibts da irgendwoe Tutors oder Hilfen zu??

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Sa 14.06.03 14:27 
Was verstehst du unter aktiv bleiben. In welcher Hinsicht soll es aktiv bleiben. Ich glaube du brauchst ein NonVcl Programm. Dazu mußt du aber die ausquetschen, die sich da besser auskennen. Auf der Seite von Luckie findest du einige Tuts und Links zu weiteren NonVcl Seiten.

Aber gehen wir mal davon aus, daß du einfach nur eine Kleinigkeit machen willst. Dann reicht auch sowas:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
program Project1;

uses
  Dialogs;

begin
  ShowMessage('Hallo ' + InputBox('Eingabe''Bitte Namen eingeben''Popov'));
end.


Oder ein Konsolenprogramm:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
program Project1;
{$APPTYPE CONSOLE}

uses
  Windows;

var
  s: String;
begin
   Write('Bitte Namen eingeben: ');
   Readln(s);
   Writeln('Hallo ', s);
   Readln;
end.

_________________
Popov
fcg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Sa 14.06.03 14:46 
ich meine mit aktiv bleiben, eigentlich nur das es sich nicht schließt! Das Programm soll ständig schauen, ob ein ganz bestimmtes Fenster offen ist und dieses dann schließn. Mehr soll das Programm eigentlich nicht machen.

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 14.06.03 15:09 
Mach ein ganz normales VCL Programm, pack es in die TNA und mach das Formular unsichtbar. Über ein Menü von dem TNA Icon kann man es dann sogar bei Bedarf schließen.

Das wäre jetzt das einfachste für dich.
fcg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 360

WinXP
D3 Prof, D6 Pers
BeitragVerfasst: Sa 14.06.03 15:42 
Das habe ich auch schon gemacht. Aber ich dachte mir halt, das es nicht die optimlalösung ist, und deswegen habe ich nach nem anderen Weg gesucht, aber ich glaube das mit Service enrichten ist nen bissle schwieriger...

fcg

_________________
.: Wer für alles offen ist, kann nicht ganz dicht sein! :.