Autor Beitrag
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Sa 13.09.03 18:41 
Hi,
wenn ich von einer Anwendung die Endung von exe auf sbin ändere belibt die anwendung ja weiterhin erhalten. Aber wenn ich das jetzt aufrufe kommt der Öffnen mit-Dialog -logisch. Wenn auch aus Delphi mit ShellExecute die Datei Aufrufe kommt auch der Öffnen mit-Dialog. Wie kann ich Delphi sagen das die Datei ein programm ist und er die wie eine normale exe starten soll.

Greetz
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 13.09.03 18:49 
Mit Suche in: Delphi-Forum, Delphi-Library CREATEPROCESS müßte es gehen.
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 14.09.03 10:31 
Ist das ein API-Befehl? Wie verwende ich CreateProcess? Das erinnert mich irgendwie an die Jedi VCL Komponente CreateProcess :-)

Danke für deine Antwort.


Greetz
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 14.09.03 11:41 
folgendes hab ich im EDH2k gefunden. probiers mal damit:
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:
procedure ExecuteFile(const AFilename: String;
                      AParameter, ACurrentDir: String; AWait: Boolean);
var
  si : TStartupInfo;
  pi : TProcessInformation;
begin
  if Length(ACurrentDir) = 0 then begin
    ACurrentDir := ExtractFilePath(AFilename);
    if ACurrentDir[Length(ACurrentDir)] = '' then
      Delete(ACurrentDir, Length(ACurrentDir), 1);
  end;
  FillChar(si, SizeOf(si), 0);
  with si do begin
    cb := SizeOf(si);
    dwFlags := STARTF_USESHOWWINDOW;
    wShowWindow := SW_NORMAL;
  end;
  FillChar(pi, SizeOf(pi), 0);
  if Length(AParameter) = 0 then
    AParameter := Format('"%s"', [AFilename])
  else
    AParameter := Format('"%s" %s', [AFilename, AParameter]);
  if CreateProcess(Nil, PChar(AParameter), Nil, Nil, False,
                   CREATE_DEFAULT_ERROR_MODE or CREATE_NEW_CONSOLE or
                   NORMAL_PRIORITY_CLASS, Nil, PChar(ACurrentDir), si, pi) then
  begin
    try
      if AWait then WaitForSingleObject(pi.hProcess, INFINITE);
    finally
      CloseHandle(pi.hProcess);
      CloseHandle(pi.hThread);
    end;
  end;
end;

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 14.09.03 18:42 
Das habe ich in der DP Code lib auch gefunden :-) Habs jetzt aber anders gelöst.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 15.09.03 09:31 
Die Suche hier im Delphi-Forum hätte innerhalb von nur wenigen Sekunden einige brauchbare Beispiel geliefert.

Gruß
Tino