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: So 31.08.03 19:10 
Hi Leutz,
ich habe für die ShellListView ein onclick event erstellt. Funktioniert ja auch, aber wenn man jetzt auf eine freie fläche in der ShellListView klickt kommt eine access violation. was kann ich dagegen tun?

Greetz
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mo 01.09.03 08:26 
Hi,

was macht denn deine OnClick-Prozedur genau? Kannst du vielleicht den Code posten? Wird dann die angeklickte Datei geöffnet?

MFG

- Ernesto -
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: Mo 01.09.03 09:33 
Hi,
die datei wird nicht geöffnet ich lasse mit der folgenden Procedure 2 Fehler laden die den Dateinamen benutzen. Dies geht ja auch.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
synedit1.lines.loadfromfile (
    shelllistview1.Root + '\' 
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + ('\') 
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + '.html'
  );
memo2.lines.loadfromfile (
    shelllistview1.Root + '\' 
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + ('\') 
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + '.des'
  );


Greetz
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mo 01.09.03 10:10 
Hi,

also eine Möglichkeit ist die ShellListView in einer Schleife durchzugehen und zu gucken ob was selektiert ist. Nur wenn was ausgewählt ist, wird der Code ausgeführt. Dann gibts auch keine AccesViolation.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.ShellListView1Click(Sender: TObject);
var
  i: Integer;
begin
  for i := 0 to ShellListView1.Items.Count - 1 do
    if ShellListView1.Items[i].Selected then
      caption := ShellListView1.SelectedFolder.PathName;
end;


Habs getestet; geht.

MFG

- Ernesto -
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: Mo 01.09.03 10:45 
OK, werds gleich testen. Danke für deine Antwort.
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 01.09.03 14:22 
Versuch es mal so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
If not Assigned (ShellListView1.SelectedFolder) Then
  Exit;

synedit1.lines.loadfromfile ( 
    shelllistview1.Root + '\'  
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + ('\')  
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + '.html' 
  ); 
memo2.lines.loadfromfile ( 
    shelllistview1.Root + '\'  
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + ('\')  
    + ExtractFilename(ShellListView1.SelectedFolder.PathName) + '.des' 
  );

Gruß
Tino
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: Mo 01.09.03 16:33 
@ErnestoChe:

Der Code geht net :-(

@Tino:

geht auch net. Compiler-Meldung: Variable erforderlich
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 01.09.03 17:06 
onlinehome hat folgendes geschrieben:
geht auch net. Compiler-Meldung: Variable erforderlich

Dann sei doch mal etwas kreativ :-D
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: Mo 01.09.03 17:40 
Tino hat folgendes geschrieben:
onlinehome hat folgendes geschrieben:
geht auch net. Compiler-Meldung: Variable erforderlich

Dann sei doch mal etwas kreativ :-D


Hmm...

wenn der Fehler kommt wird die erste Zeile des codes (das mit assigned) rot markiert. Der Textcurser bleibt vor then stehen. Mit then wird wohl alles stimmen. Mit shelllistview aber auch. Is Assigned vielleicht ne variable. Oder soll das ganze mit den Code von ErnestoChe verbunden werden???

*nixcheck*
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Di 02.09.03 11:06 
Hi,

onlinehome hat folgendes geschrieben:
Der Code geht net


Kann ich mir nicht vorstellen. Was kommt denn genau für ein Fehler? Kommt immer noch eine Acces Violation? Also ich habs bei mir getestet, es geht.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.ShellListView1Click(Sender: TObject); 
var 
  i: Integer; 
begin 
  for i := 0 to ShellListView1.Items.Count - 1 do 
    if ShellListView1.Items[i].Selected then 
    begin
        // deine Anweisungen
    end;
end;


Du kannst es auch alternativ mit try except abfangen. Wenn du dann das Programm außerhalb vom Delphi-Debugger startest, kommt auch keine Acces Violation.

MFG

- Ernesto -
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: Di 02.09.03 11:20 
Es geht. Danke. Komisch ne. Wahrscheinlichvorhin was vergessen oder so. ABER ES GEHT!