Autor Beitrag
Biarchiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Mi 03.11.10 16:03 
Hallo,

ich öffne mit der PDF ActiveX ganz normal PDF Dateien. Diese werden auch wunderbar angezeigt und alles läuft super.

Nur manchaml beim Beenden des Programms bekomme ich etwa 1 - 2 Sekunden nachdem mein Program schon geschlossen ist den Fehler: Die Anweisung in "0x700609c" verweist auf Speicher in "0x00000014". Der vorgang "read" konnte nicht auf dem Speicher durchgeführt werden.

Mein Code:

OnCreate:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.FormCreate(Sender: TObject);
begin
AcroPDF1 := TAcroPDF.Create(SELF);
AcroPDF1.Parent := self; // wichtig da sonst nichts angeszeigt wird. Oder  //place control over a panel so we can control position and size      AcroPDF1.Parent := panel1;
AcroPDF1.Visible := true;
AcroPDF1.Height := 1;
AcroPDF1.Width := 1;
AcroPDF1.Top := Form1.Height - 30;
AcroPDF1.Left := Form1.Width - 30;
AcroPDF1.Hide;
end;


OnClick - Button:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
    AcroPDF1.Visible := True;
    AcroPDF1.Align := alClient;
    ScrollBox1.Hide;
    RichEdit1.Hide;
    AcroPDF1.LoadFile(GetTempDir + '\' + 'mypdf');
    AcroPDF1.setShowToolbar(False);
    DeleteFile(GetTempDir + '\' + 'mypdf');
    ScrollBox1.Hide;
    AcroPDF1.Show;
    AcroPDF1.SetFocus; //wichtig da sonst beim beenden crashed


Kann mir da wer helfen?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19312
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 04.11.10 06:55 
Gib am besten das Objekt selber frei statt das dem übergebenen Owner (hier Self) zu überlassen. Übergib da einfach einmal nil und gib das Objekt selbst frei.

Entweder kommt dann auch der Fehler direkt (dann läuft da etwas im Speicher schief) oder dann funktioniert alles.

Wenn es dann auch verzögert passiert, läuft da noch etwas in dem PDF-Objekt obwohl in deinem Programm schon etwas nicht mehr vorhanden ist (Events zugewiesen? ...).
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Do 04.11.10 18:34 
Hallo,

danke für die Antwort. Geht nicht. Ich hab schon 50 verschiedene Kombinationen ausprobiert.

Egal ob mit Free oder NIL am Ende. Geht nicht. In Win7 kommt das nicht vor. Es ist auch nur jede 2. pdf davon betroffen.

Mit dem Suchwort: 0x0700609c findet man einiges im Adobe Forum aber leider kein Lösung für Delphi.
Gerd Kayser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 632
Erhaltene Danke: 121

Win 7 32-bit
Delphi 2006/XE
BeitragVerfasst: Do 04.11.10 19:04 
Schau Dir das einmal an, vielleicht hilft es Dir weiter: stackoverflow.com/qu...at-closing-problem-c
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Do 04.11.10 19:27 
user profile iconGerd Kayser hat folgendes geschrieben Zum zitierten Posting springen:
Schau Dir das einmal an, vielleicht hilft es Dir weiter: stackoverflow.com/qu...at-closing-problem-c


Hallo,

danke, allerdings hab ich den Link schon gefunden. Leider kann ich zuwenig C. Wie müsste ich das auf Delphi anwenden? Das Problem ist das es AcroPDF1.Dispose(); nicht gibt.
Gerd Kayser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 632
Erhaltene Danke: 121

Win 7 32-bit
Delphi 2006/XE
BeitragVerfasst: Do 04.11.10 19:35 
user profile iconBiarchiv hat folgendes geschrieben Zum zitierten Posting springen:
Wie müsste ich das auf Delphi anwenden?

Ich hab zwar mit dem C#-Geraffel nix am Hut, aber für mich sieht das so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
AcroPDF1.Free;
Application.ProcessMessages;
CoFreeUnusedLibraries;  //uses ActiveX

Das Ganze vielleicht im Close-Ereignis des Formulars.
Biarchiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 688



BeitragVerfasst: Do 04.11.10 20:19 
Danke Gerd Kayser !!!

Geht super ;)