Autor Beitrag
cscp
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 49



BeitragVerfasst: Mo 24.01.05 20:37 
Hallo,
ich habe folgendes Problem:
Ich habe ein Programm programmiert, das bei Form.Create eine Aufgabe erledigt...
Wenn diese nun erledigt ist, soll sich das Programm wieder selbst von alleine schließen..
Es werden keine Benutzereingaben gemacht sondern es wird nur ein String ausgelesen und gedruckt... aber wenn ich einfach close schreibe funzt das irgendwie nicht, nehme mal an das hat mit Form.Create zutun!
Danke für eure Hilfe!
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Mo 24.01.05 20:41 
Jep, hat was mit FormCreate zu tun. Hässliche Lösung: Timer auf die Form, da den Code rein, dann gehts ;)

AXMD
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mo 24.01.05 20:42 
Jojo, das liegt daran, dass du keine Form schließen (.Close) kannst, wenn sie noch gar nicht richtig da ist (sie ist ja noch beim .OnCreate).

Versuch mal Form1.OnActivate als Ereignis... :wink:

//EDIT: @AXMD O Gott, o Gott... Was für eine SCHRECKLICHE LÖSUNG!!! :lol:

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mo 24.01.05 20:44 
oder besser in onshow

mit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var blub: boolean =false;

proceduer TForm1.OnShow(Sender: TObject)
begin
  if not blub then
    // code

  blub := true;
end;



wobei du die abfrage eh nicht brauchst wenn sichs wieder sofort schließt

vill geht auch Form1.Activate oder Resize mussu mal testen
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mo 24.01.05 20:46 
Okay, OnShow is glaub ich sogar besser als OnActivate.. :cry:

Aber was hat die ganze Sache denn mit OnResize zu tun??? :roll: :?: :?:

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 24.01.05 20:49 
Schreibe im OnCreate-Ereignis anstatt "Close;" mal
ausblenden Delphi-Quelltext
1:
PostMessage(handle, WM_CLOSE, 0, 0);					


MfG
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mo 24.01.05 20:51 
Und noch eine Lösung: In der Project1.dpr einfach das

ausblenden Delphi-Quelltext
1:
Application.Run					

rausnehmen!! :D :lol:

Will noch jemand??

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mo 24.01.05 20:52 
direkt ne consolenanwendung schreiben
bzw die Unit1.pas eifnach aus dem projekt entfernen udn den ganzen code in Project1.dpr schreiben oO
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mo 24.01.05 20:55 
Ja gut, aber in der Konsolenanwendung hast du viel weniger Optionen als in einer VCL-App!! Mit den ganzen Ereignissen und so...

Obwohl, die wird er nicht wirklich brauchen wenn er nur nen String speichern will... :lol:

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.
cscp Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 49



BeitragVerfasst: Mo 24.01.05 21:02 
ok habs jetzt im onshow funzt auch! aber das form wird nicht mehr angezeigt...
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mo 24.01.05 21:04 
is ja auch logisch... wenn du in OnShow deine Anwedung wieder schließt siehste nur nen kurzes flackern
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mo 24.01.05 21:04 
Huch!! Wie jetzt?? :gruebel:

Soll sich dein Programm denn gleich wieder schließen oder nich?? Das Form geht schon auf, aber so schnell wieder zu, dass du's nimmer siehst!!! :D

//EDIT: Schon wieder, ich bin echt vom Pech verfolgt... Immer zu spät... :motz: :lol:

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.


Zuletzt bearbeitet von WeBsPaCe am Mo 24.01.05 21:05, insgesamt 1-mal bearbeitet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 24.01.05 21:04 
WeBsPaCe hat folgendes geschrieben:
Das Form geht schon auf, aber so schnell wieder zu, dass du's nimmer siehst!!! :D
Bei mir nicht, bei mir nicht!! :D

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mo 24.01.05 21:06 
Christian S. hat folgendes geschrieben:
WeBsPaCe hat folgendes geschrieben:
Das Form geht schon auf, aber so schnell wieder zu, dass du's nimmer siehst!!! :D
Bei mir nicht, bei mir nicht!! :D

Bääääähh!!! Klugscheißer!!! :lol:

Bei mir auch nicht, oder?? Also das mit Application.Run weglassen... :?:

_________________
Steht der Bauer im Gemüse, hat er später grüne Füße.