Autor Beitrag
Xadron
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102

XP
C++, D7, HTML
BeitragVerfasst: Sa 31.03.07 11:16 
Wenn ich der Filelistbox ein Doppelklickereigniss gebe und hineinschreibe:

ausblenden Delphi-Quelltext
1:
2:
3:
if FileListbox1.Items.Count > 0 then
if FileListbox1.ItemIndex <> -1 then
winexec.FileName := FileListbox1.Items[FileListbox1.ItemIndex];


Würde es nicht gehen, weil Item ja nicht vorhanden ist. Was muss ich dadurch ersetzen und welche Parameter fehlen?

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt

_________________
|x-32:88x+39-3|+3:21=47-4x
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 31.03.07 11:34 
Vieleicht würde es helfen, wenn Du einfach schreibst was Du vorhast. :wink:

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Xadron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102

XP
C++, D7, HTML
BeitragVerfasst: Sa 31.03.07 11:41 
Wie bei dem Explorer, will ich eine Datei aus der Filelistbox auswählen und ausführen, z.B. eine exe, ein bild , ein document... .

_________________
|x-32:88x+39-3|+3:21=47-4x
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 31.03.07 11:49 
ShellExecute, da solltest Du hier massig finden wird alle zwei Tage gefragt.

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Xadron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102

XP
C++, D7, HTML
BeitragVerfasst: Sa 31.03.07 12:00 
ja, aber es geht mir nicht nur ums ausführen, sondern das selektierte aus der fillistbox auszuführen.
Deswegen hatte ich auch hiermit rumhantiert:

ausblenden Quelltext
1:
2:
if FileListbox1.Items.Count > 0 then
if FileListbox1.ItemIndex <> -1 then

_________________
|x-32:88x+39-3|+3:21=47-4x
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 31.03.07 12:40 
user profile iconXadron hat folgendes geschrieben:
ja, aber es geht mir nicht nur ums ausführen, sondern das selektierte aus der fillistbox auszuführen.
Deswegen hatte ich auch hiermit rumhantiert:

ausblenden Quelltext
1:
2:
if FileListbox1.Items.Count > 0 then
if FileListbox1.ItemIndex <> -1 then

Nicht ums ausführen, aber ums ausführen (Bahnhof). :roll:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.FileListBox1DblClick(Sender: TObject);
begin
  if FileListbox1.Items.Count > 0 then
  MyPfad:=DirectoryListBox1.Directory+'/'+FileListbox1.Items[FileListbox1.ItemIndex];
  //Pfad an ShellExecute Fertsch
end;

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Xadron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102

XP
C++, D7, HTML
BeitragVerfasst: Sa 31.03.07 13:23 
...genau.

Habs mal umgebastelt und das kam dabei raus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.FileListBox1DblClick(Sender: TObject);
begin
if FileListbox1.Items.Count > 0 then
ShellExecute(DirectoryListBox1.Directory+'/'+FileListbox1.Items[FileListbox1.ItemIndex]);
end;


Dafür meint er dann:
[Warnung] Unit1.pas(7): Unit 'FileCtrl' ist plattformspezifisch
[Fehler] Unit1.pas(364): Inkompatible Typen: 'HWND' und 'String'


Also würde ich mal sagen, dass man da HWNDToStr stehen müste, wenn es überhaupt HWND heißt.
Oder hat das was mit dem PCChar zu tuhen?

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt

_________________
|x-32:88x+39-3|+3:21=47-4x
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Sa 31.03.07 13:27 
Suche in: Delphi-Forum, Delphi-Library SHELLEXECUTE benötigt ja auch ganz andere Argumente...

Wie Shellexecute funktioniert findest du z.B. hier: www.dsdt.info/tipps/...;search=shellexecute
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 31.03.07 13:34 
Sind mal nicht So, aber trotzdem mal mit befassen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FileListBox1DblClick(Sender: TObject);
var
 MyPfad:String;
begin
  if FileListbox1.Items.Count > 0 then
  MyPfad:=DirectoryListBox1.Directory+'/'+FileListbox1.Items[FileListbox1.ItemIndex];
  //Pfad an ShellExecute Fertsch
  ShellExecute(0, 'open', PCHAR(MyPfad), NIL, NIL, SW_SHOW);
end;

ShellApi nicht vergessen einzubinden, falls nicht schon geschehen.

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Xadron Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102

XP
C++, D7, HTML
BeitragVerfasst: Sa 31.03.07 14:44 
oh gott...das ist mir peinlich :oops:
natürlich funktioniert es jetzt...

_________________
|x-32:88x+39-3|+3:21=47-4x