Autor Beitrag
Hochhäusl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Mi 14.08.02 14:23 
Hi,

wie kann ich einen bestimmten Ordner (z.B. 'D:\Test') per klick auf einen Button öffnen?


mit Dank im voraus

Hochhäusl
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Mi 14.08.02 14:26 
Hallo,

du kannst Ihn wie ein ausführbahres Programm mit ShellExecute öffnen.

Gruß
Klabautermann
Hochhäusl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Mi 14.08.02 14:46 
Danke für deine Antowrt, aber kannst du mir vielleicht ein Beispiel geben?
Ich kenn mich mit ShellExcute gar nicht aus

mfg
lemming
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 470

Mac OS 10.3.1
Delphi 6 Pro, Kylix 3
BeitragVerfasst: Mi 14.08.02 14:59 
ausblenden Quelltext
1:
Result := ShellExecute(Application.MainForm.Handle, nil, StrPCopy(zFileName, FileName), StrPCopy(zParams, Params), StrPCopy(zDir, DefaultDir), ShowCmd);					


Result ist ein THandle.

Wenn dir das zu schwer ist fügst du in dein Projekt einfach die Datei fmxutils.pas ein. Die findest du in deinem Delphi Ordner unter \Demos\Doc\Filmanex. Du kannst das durch anklicken des Icons mit dem grünen Pluspfeil neben dem Save Icon in dein Projekt einfügen.

So dann musst du in deinem Code in der uses Klausel das wort "fmxutils" einfügen. So ungefähr:
ausblenden Quelltext
1:
2:
3:
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, fmxutils;


So, dann kannst du per Knopfdruck einen Ordner öffnen:
ausblenden Quelltext
1:
  ExecuteFile('c:\windows', '', '', 0);					


oder den Browser:

ausblenden Quelltext
1:
  ExecuteFile('http://www.hardtware.de', '', '', 0);					


oder eine Anwendung

ausblenden Quelltext
1:
  ExecuteFile('c:\windows\notepad.exe', 'c:\autoexec.bat', 'c:\', 0);					
Hochhäusl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57



BeitragVerfasst: Mi 14.08.02 16:18 
Danke
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Mi 14.08.02 18:09 
Hallo,

die Suchfunktion des Forums hat mich unter anderen zu diesem Posting geführt. Dort müsstest du nur anstelle von Edit1.Text deinen Verzeichnisnamen einsetzen.

Gruß
Klabautermann