Autor Beitrag
Segaja
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

Win XP
D7 Enterprise
BeitragVerfasst: Sa 09.04.05 07:25 
wie rufe ich beim formularstart ein programm auf?

mfg
Segaja


Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am Mi 13.04.2005 um 10:44
Hansi@OMG
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 304

Vista
Delphi 2006 Prof., Lazarus
BeitragVerfasst: Sa 09.04.05 07:45 
Ganz einfach, du bindest die Unit shellapi ein und schreibst in dein Form.Create rein:
ausblenden Delphi-Quelltext
1:
shellexecute(0,PCHAR('C:\test.exe'),0,nil,SW_SHOWNORMAL);					

_________________
Who doesn't know the Micrsoft developer "Mahatma Fatal Error"?
Segaja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

Win XP
D7 Enterprise
BeitragVerfasst: Sa 09.04.05 07:47 
dumme frage: wie binde ich die unit shellexecute ein?
Hansi@OMG
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 304

Vista
Delphi 2006 Prof., Lazarus
BeitragVerfasst: Sa 09.04.05 07:53 
Oben in deinem Programm steht unter interface:

ausblenden Delphi-Quelltext
1:
2:
3:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

Da schreibst du mit Komma getrennt shellapi dazu!
ausblenden Delphi-Quelltext
1:
2:
3:
uses
  Windows,shellapi, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

_________________
Who doesn't know the Micrsoft developer "Mahatma Fatal Error"?
Segaja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

Win XP
D7 Enterprise
BeitragVerfasst: Sa 09.04.05 08:01 
das ist mein programm:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
unit Unit1;

interface

uses
  Windows,shellapi, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  shellexecute(0,PCHAR('C:\Windows\notepad.exe'),0,nil,SW_SHOWNORMAL);
end;

end.



und das sind die fehlermeldungen:

ausblenden Quelltext
1:
2:
3:
[Warnung] Unit1.pas(26): Konstante 0 wurde zu NIL konvertiert
[Fehler] Unit1.pas(26): Inkompatible Typen: 'Integer' und 'PChar'
[Fataler Fehler] Project2.dpr(5): Verwendete Unit 'Unit1.pas' kann nicht compiliert werden


wo is der fehler?
Hansi@OMG
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 304

Vista
Delphi 2006 Prof., Lazarus
BeitragVerfasst: Sa 09.04.05 08:50 
oh, sorry, hab was vergessen, der befehl muss heißen:
ausblenden Delphi-Quelltext
1:
shellexecute(0,'open',PCHAR('C:\test.exe'),0,nil,SW_SHOWNORMAL);					

_________________
Who doesn't know the Micrsoft developer "Mahatma Fatal Error"?
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 09.04.05 09:45 
also wenn mans ganz korrekt machen will dann sollte es so heissen:
ausblenden Delphi-Quelltext
1:
shellexecute(handle,'open',PCHAR('C:\test.exe'),nil,nil,SW_SHOWNORMAL);					

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Segaja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

Win XP
D7 Enterprise
BeitragVerfasst: Sa 09.04.05 18:07 
thx für die hilfe, es funktioniert.

mfg
Segaja
Segaja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

Win XP
D7 Enterprise
BeitragVerfasst: So 10.04.05 20:02 
wie schaffe ich es,dass das delphi programm sich danach selbst beendet?
Kroni
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 720

Win 98, Win ME, Win2k, Win XP
D3 Pro
BeitragVerfasst: So 10.04.05 20:39 
indem du im Form1.show ein Form1.close; einbaust. dann beendet sichi das Programm direkt nach dem Starten wieder..
oder einfach hinter dem Shellexecute ein close;
Wenn du direkt im oncreate ein close; einbaust, schließt sich dein Programm nicht....

aber warum willst du durch ausführen deines Programms das Notepad öffnen??
der nutzen des Programms ist mri nicht klar!
Segaja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

Win XP
D7 Enterprise
BeitragVerfasst: So 10.04.05 20:55 
irgendwie bin ich da gerade zu doof für. kann mir das jemand in quelltext geben?
Segaja Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

Win XP
D7 Enterprise
BeitragVerfasst: So 10.04.05 21:38 
hat sich erledigt. habe in den faq den befehl Application.terminate; gefunden und eingebaut.