Autor Beitrag
Hendi48
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: So 03.06.07 20:09 
Hi, also ich hab wieder ein Problem mit ShellExecute:
ausblenden volle Höhe 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:
30:
31:
32:
33:
34:
35:
procedure TMainForm.FlyFF1Click(Sender: TObject);
var
Reg: TRegistry;
regPath: String;
Dateiname : string;
GGPath: String;
PathString: String;
Quelldatei, Zieldatei : string;
OwnPath: String;
begin
  Reg:=TRegistry.Create;
  try
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('SOFTWARE\GalaNetEu\Flyff',false) then
      regPath:=reg.ReadString('App Path');
  except
    showmessage('Fehler: Unable to read from Flyff''s registry');
  end;

  GGPath:=regPath+'\GameGuard\Splash.jpg';
  if not DeleteFile(GGPath) then
  ShowMessage('Datei "'+Dateiname+'" konnte nicht gelöscht werden!');
  sleep(100);
  OwnPath:=ExtractFilePath(ParamStr(0))+'Tools\Splash.JPG';
  if not CopyFile(PChar(OwnPath), PChar(GGPath), true) then
  ShowMessage('Datei "'+Quelldatei+'" konnte nicht kopiert werden!');

  PathString:=regPath+'\Flyff.exe';

  if FileExists(PathString) then
    ShellExecute(Handle, 'open', PChar(PathString), nilnil, SW_SHOWNORMAL)
  else
    showmessage('Flyff existiert nicht?! WTF?!');
   Reg.Free;
  end;

Also wenn man im Menü was auswählt, wird diese procedure gemacht hier, es startet auch soweit und so nur es kopiert dann ini dateien und ordner in den ordner wo das programm mit dem menü ist. Wie kann ich das verhindern?
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 04.06.07 00:39 
user profile iconHendi48 hat folgendes geschrieben:
Hi, also ich hab wieder ein Problem mit ShellExecute:
...
es kopiert dann ini dateien und ordner in den ordner wo das programm mit dem menü ist. Wie kann ich das verhindern?

Was hat das nicht erwünschte Kopieren von Dateien mit ShellExecute zu tun?

Lösung deines Problems: Kopiere die Dateien einfach nicht. Oder allgemeiner ausgedrückt: "Der Computer tut, was du ihm sagts, nicht was du willst." Und du sagst ihm anscheinend, dass er die Dateien kopieren soll.
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Mo 04.06.07 13:27 
nein, sag ich nicht. Ich sag das er EINE datei von dem ordner meines programm in den ordner des Spiels kopieren soll und dann das Spiel mit Shellexecute ausführen soll
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 24.06.07 10:40 
Hi,

das hier ist in jedem fall problematisch: ExtractFilePath(ParamStr(0))

wenn du mit deinem programm irgendwo anders in der dateistruktur rummachst, verändert sich dieser parameter(soviel ich weiß), also entweder du tuts dann von anfang an in eine variable, oder du benutzt Application.ExeName

Xion

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)
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 24.06.07 10:43 
@Xion: Application.ExeName setzt auf ParamStr(0) auf.

_________________
Markus Kinzler.
Xion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
EE-Maler
Beiträge: 1952
Erhaltene Danke: 128

Windows XP
Delphi (2005, SmartInspect), SQL, Lua, Java (Eclipse), C++ (Visual Studio 2010, Qt Creator), Python (Blender), Prolog (SWIProlog), Haskell (ghci)
BeitragVerfasst: So 24.06.07 10:47 
echt? mist :oops:

_________________
a broken heart is like a broken window - it'll never heal
In einem gut regierten Land ist Armut eine Schande, in einem schlecht regierten Reichtum. (Konfuzius)