Announcement

Collapse
No announcement yet.

Extract filepath

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extract filepath

    Var
    Programmpath: String;
    begin
    Programmpath:=ExtractFilePath(ParamStr(0));
    end;

    wie kann ich den gefundenen Pfad in ShellExecute einbauen?

    könnt ihr den Quelltext beschreiben?
    danke.
    If it's there and you can see it – it's REAL
    If it's there and you can't see it – it's TRANSPARENT
    If it's not there and you can see it – it's VIRTUAL
    If it's not there and you can't see it – it's GONE!

  • #2
    Hi Christian,<br>sehr rätselhaft...<br> ParamStr(0) ist der erste übergebene Parameter beim Start deines Programmes.<br>
    Also z.B. test.exe rot würde bei ParamStr(0) "rot" ergeben.<br>
    Ich finde keinen richtigen Zusammenhang mit Shellexecute!<br>
    <PRE>
    HINSTANCE ShellExecute(

    HWND hwnd, // handle to parent window
    LPCTSTR lpOperation, // pointer to string that specifies operation to perform
    LPCTSTR lpFile, // pointer to filename or folder name string
    LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
    LPCTSTR lpDirectory, // pointer to string that specifies default directory
    INT nShowCmd // whether file is shown when opened
    );
    </PRE&gt

    Comment


    • #3
      @Michael,<br>
      FASLCH! ParamStr(0) ist der Name der Exe!<br>
      Programmpath:=ExtractFilePath(ParamStr(0)) sollte also das gleiche wie Programmpath:=ExtractFilePath(Application.ExeName) zurückgeben.<p>
      @Christian,<br>
      was willst Du denn ausführen? Ein Porgramm oder einen "Befehl", bzw. eine Verknüpfung?<br>
      Normalerweise sollte man Programme mit <b>CreateProcess</b> starten...<p>
      Luc

      Comment


      • #4
        Normale Programmaufrufe ohne Besonderheiten mach ich mit einem Befehl wie

        <TT>
        ShellExecute(self.Handle, 'open', @Programmpath[1],nil, nil, SW_SHOW);
        </TT>

        Allerdings steht da normalerweise ein Dateiname drin und nicht nur ein Verzeichnis.

        Wenn es nicht aus einer Methode eines Formulars heraus aufgerufen wird, kann man natürlich nicht "self" verwenden, sondern muss z.B. Application.Mainform.Handle stattdessen benutzen.

        Gruß,

        Stefan Balzte

        Comment

        Working...
        X