Autor Beitrag
sonic159
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Windows XP
BDS 2006 Professional
BeitragVerfasst: So 07.05.06 11:52 
Hallo!

Könnt ihr mir sagen, wie mein Programm sich nach dem beenden selbst löschen kann?
Bei OnExit oder OnClose oder wie das heißt!

Thx, MfG: Sonic!


Moderiert von user profile iconChristian S.: Topic aus Internet / Netzwerk verschoben am So 07.05.2006 um 13:19
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 07.05.06 11:56 
Ein Programm kann sich direkt nicht selber löschen, da die Exe dann noch geöffnet ist. Du wirst ein anderes Programm z.B. batxh starten müssen, welches das für dich erledigt.

_________________
Markus Kinzler.
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: So 07.05.06 11:59 
Was ist denn batxh?

Hab hier mal was im Forum gefunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure KillSelf(MainForm: TForm); 
begin 
  with TStringList.Create do try 
    Add(':Label1'); 
    Add('del "' + Paramstr(0) + '"'); 
    Add('if Exist "' + Paramstr(0) + '" goto Label1'); 
    Add('del "' + ExtractFilePath(Paramstr(0)) + 'name.bat"'); 
    SavetoFile(ExtractFilePath(Paramstr(0)) + 'name.bat'); 
  finally Free end; 
  //Ausführen 
  ShellExecute(MainForm.Handle, 'open', PChar(ExtractFilePath(Paramstr(0)) + 
    'name.bat'), nil, nil, SW_HIDE); 
  //Beenden 
  MainForm.Close; 
end;

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
Waldteufel
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 07.05.06 12:06 
Hi. :wave:

user profile iconBorn-to-Frag hat folgendes geschrieben:
Was ist denn batxh?

Ein Tippfehler. Es heißt Batch. ;-)

>> de.wikipedia.org/wiki/Stapelverarbeitung <<
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 07.05.06 12:06 
@Born-to-Frag batxh solte batch heißen, wie in deinem Beispiel.

_________________
Markus Kinzler.
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: So 07.05.06 13:23 
Achso :lol:

@Waldteufel: Ich weiß schon was Batch ist ;) Sonst hätte ich das Beispiel ja nicht gepostet ^^


greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.