Autor Beitrag
cybersoul
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 43



BeitragVerfasst: Fr 11.02.05 13:18 
Hi Leute,

ich habe ein Problem mit der ExtractAssociatedIcon-Funktion.

Jedesmal, wenn ich die Funktion aufrufe...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
  h:HICON; ndx:WORD; path:PChar;
  begin
    ndx:=0;
    h:=ExtractAssociatedIcon(hInstance,path,ndx);
    image1.picture.icon.handle:=h;
  end;

... bekomme ich beim Beenden des Programms folgende Fehlermeldung:

    Exception EAccessViolation in Modul Project1.exe bei 00003128
    Zugriffsverletzung bei Adresse 00403128 in Modul 'Project1.exe'.
    Lesen von Adresse 65747375.

Ich habe schon mit ReleaseHandle versucht, aber das hat auch nicht geholfen.
An der TImage-Komponente kann es auch eigentlich nicht liegen, da ich
auch versucht habe die letzte Code-Zeile wegzulasen.

Ich weiß echt nicht mehr weiter!
Könnt ihr mir helfen?

Heiko

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 11.02.05 13:58 
Sieh dir mal dieses Beispiel an...

Ich weiß, sieht eigentlich gleich aus, aber versuchs mal damit.

Allerdings vermute ich, dass der Fehler doch bei picture.icon.handle liegt, ich kann mich dunkel daran erinnern, dass es da bei mir auch irgendwann ein Problem gab.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 11.02.05 14:32 
Lokale Variablen müssen vor Benutzung initializiert werden!

_________________
Ciao, Sprint.
cybersoul Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 43



BeitragVerfasst: So 13.02.05 00:58 
Na ihr seid mir ja wieder tolle Advanced-Member!
Die Variablen werden natürlich gesetzt,
ich habe hier nur ein Beispiel gebracht!
cybersoul Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 43



BeitragVerfasst: So 13.02.05 01:12 
Hat sich schon erledigt.
War wohl ein Delphi-Bug.
Hab das gleiche Projekt heute ochmal geladen und alles funzt.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: So 13.02.05 02:02 
cybersoul hat folgendes geschrieben:
Na ihr seid mir ja wieder tolle Advanced-Member!
Die Variablen werden natürlich gesetzt,
ich habe hier nur ein Beispiel gebracht!

Dann poste doch hier ein richtiges Beispiel, das nicht funktioniert. Das war ein Fehler der sofort ins Auge fiel.
Hellsehen kann ich nicht.

_________________
Ciao, Sprint.