Autor Beitrag
achi 3.0
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Di 22.09.09 08:28 
Hallo,

habe in letzter Zeit das Problem das wenn ich im Opendialogfenster das Verzeichnis wechseln will das Programm abstürzt. Mir ist aufgefallen dass dies nur passiert wenn ich das Programm in Delphi laufen habe. Wenn ich nur die Exe ausführe klappt es.

Gruß
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 22.09.09 08:31 
Wie macht sich der Absturz denn genau bemerkbar? Kommt eine Fehlermeldung, reagiert das Programm nicht mehr, Bluescreen...?

_________________
We are, we were and will not be.
achi 3.0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Di 22.09.09 09:17 
Das programm reagiert nicht mehr, ich bekomme keine Fehlermeldung. Es geht einfach nix mehr.
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: Di 22.09.09 09:18 
Ein ähnliches Problem hatte ich auch, konnte es auch reproduzieren, aber nicht beheben. Bei mir kam eine Zugriffsverletzung dabei.

Nachdem ich mein Backup wieder zurückgespielt hatte, funktionierte es wieder. Woran es letztlich gelegen hatte, konnte ich nicht herausfinden, habe allerdings auch nicht besonders lange gesucht.
PreMarT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 57

Work: Win XP ; Home: Win Vista 64-Bit

BeitragVerfasst: Di 22.09.09 09:20 
Hi,

Kannst du vielleicht mal den Code dazu posten?

Hast du irgendwelche optionen eingestellt, oder andere Parameter?
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: Di 22.09.09 09:22 
Also bei mir gab es keinen zusätzlichen Code. Leider finde ich gerade den Thread dazu nicht mehr. :nixweiss:
Es gab den Fehler schon mit einer neuen leeren Anwendung nur mit dem angezeigten Dialog in einem Button-Klick.
achi 3.0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Di 22.09.09 09:31 
genau so ist es bei mir auch. ich habe den fehler auch bei einer leeren anwendung nur mit einem opendialog. mittels buttonclick.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Di 22.09.09 09:36 
Schreib mal den Code wie du drauf zugreifst...
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: Di 22.09.09 09:39 
Ich würde dazu raten einfach ein Backup aufzuspielen, wenn du eins hast. Wenn nicht: Nun ja, vielleicht denkst du dann ja beim nächsten Mal rechtzeitig dran eins zu machen, aus Schaden wird man klug. Denn letztendlich bleibt dir ja vermutlich dann nur eine Neuinstallation. ;-)

Das ist bei dir auch noch unter XP, wie ich es seinerzeit auch noch hatte? Und wie sieht es, wenn das Programm hängt, mit der Prozessauslastung aus? Tut es da noch etwas (im TaskManager)?

user profile iconthepaine91 hat folgendes geschrieben Zum zitierten Posting springen:
Schreib mal den Code wie du drauf zugreifst...
Also bei mir sah der Code so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  OpenDialog1.Execute;
end;
PreMarT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 57

Work: Win XP ; Home: Win Vista 64-Bit

BeitragVerfasst: Di 22.09.09 09:46 
Muss da net mindestens das stehen?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TfrmMain.mmLoadClick(Sender: TObject);
begin

  OpenDialog := TOpenDialog.Create(self);

  if OpenDialog.Execute then
    try
      z.B. imgage1.Picture.Loadfromfile(OpenDialog.Filename);
    except
      ShowMessage('Error while Loading File!');
    end
  else
    ShowMessage('Load File was cancelled');

end;


Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 22.09.09 09:48 
Also damit hast du schonmal ein tolles Speicherleck gebaut. ;-)

_________________
We are, we were and will not be.
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: Di 22.09.09 09:48 
Wenn der Dialog auf dem Formular liegt, muss er nicht erzeugt werden. Bei diesem Code werden immer wieder neue Dialoge erzeugt, aber erst beim Programmende wieder freigegeben... keine gute Idee.
Und ob man den Rückgabewert auswertet und danach weiteren Code ausführt, hat nichts mit dem Problem zu tun, da das Problem bereits im Execute auftritt.
PreMarT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 57

Work: Win XP ; Home: Win Vista 64-Bit

BeitragVerfasst: Di 22.09.09 09:51 
wenn ich den Code wie Ihr den gepostet hab schreibe kommt bei mir Exeption Fehler....
naja ich hab keine probs :P

EDIT : :/ jetzt weis ich was ihr meint......naja dann packt man das

OpenDialog := TOpenDialog.Create(self); halt ins FormCreate aber das muss man haben...sonnst kann man garkein Dialog öffnen...


Zuletzt bearbeitet von PreMarT am Di 22.09.09 10:00, insgesamt 1-mal bearbeitet
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 22.09.09 09:59 
Moin!

user profile iconachi 3.0 hat folgendes geschrieben Zum zitierten Posting springen:
genau so ist es bei mir auch. ich habe den fehler auch bei einer leeren anwendung nur mit einem opendialog. mittels buttonclick.
Da du leider weder die Delphi-Version noch das Betriebssystem angegeben hast, rate ich mal zumindest das OS: WinXP?

Wenn dem so ist, dann mach mal folgendes:
  • Den Inhalt des Ordners <WinDir>\Prefetch komplett löschen (kann nix passieren, sind nur Executable-Prefetches, werden automatisch wieder angelegt)
  • Rechner booten
  • Neues Konto anlegen (-> "sauberes" Userprofil)
  • Nochmal probieren
Muss nicht zwangsweise helfen, kann aber. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
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: Di 22.09.09 10:12 
user profile iconPreMarT hat folgendes geschrieben Zum zitierten Posting springen:
naja dann packt man das

OpenDialog := TOpenDialog.Create(self); halt ins FormCreate aber das muss man haben...sonnst kann man garkein Dialog öffnen...
Doch, einfach den Dialog aufs Formular legen...
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Di 22.09.09 10:34 
Jaenicke hast du mal mit dem Compiler durchgesteppt wo er genau rausspringt. Also im Execute selbst?
achi 3.0 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 63



BeitragVerfasst: Di 22.09.09 10:56 
Hi, ich nutze win Xp und Delphi5 (ich weiß ist alt aber die Umstellung kommt noch)

Also das Programm hängt sich genau im Execute auf. Habe leider kein Backup. das muss doch an windows liegen, da der dialog von windows ist oder.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Di 22.09.09 11:08 
ausblenden Delphi-Quelltext
1:
2:
3:
type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog; // Wird erzeugt wenn man die Komponente aufs Formular zieht.


So hier ist der Aufruf des Executes ;) und dort mal nachsehen wo genau der Fehler ausgelöst wird.

Unit: Dialogs
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
function TOpenDialog.DoExecute(Func: Pointer): Bool;
const
  MultiSelectBufferSize = High(Word) - 16;
  OpenOptions: array [TOpenOption] of DWORD = (
    OFN_READONLY, OFN_OVERWRITEPROMPT, OFN_HIDEREADONLY,
    OFN_NOCHANGEDIR, OFN_SHOWHELP, OFN_NOVALIDATE, OFN_ALLOWMULTISELECT,
    OFN_EXTENSIONDIFFERENT, OFN_PATHMUSTEXIST, OFN_FILEMUSTEXIST,
    OFN_CREATEPROMPT, OFN_SHAREAWARE, OFN_NOREADONLYRETURN,
    OFN_NOTESTFILECREATE, OFN_NONETWORKBUTTON, OFN_NOLONGNAMES,
    OFN_EXPLORER, OFN_NODEREFERENCELINKS, OFN_ENABLEINCLUDENOTIFY,
    OFN_ENABLESIZING, OFN_DONTADDTORECENT, OFN_FORCESHOWHIDDEN);

  OpenOptionsEx: array [TOpenOptionEx] of DWORD = (OFN_EX_NOPLACESBAR);
var
  Option: TOpenOption;
  OptionEx: TOpenOptionEx;
  OpenFilename: TOpenFilename;

  function AllocFilterStr(const S: string): string;
  var
    P: PChar;
  begin
    Result := '';
    if S <> '' then
    begin
      Result := S + #0;  // double null terminators
      P := AnsiStrScan(PChar(Result), '|');
      while P <> nil do
      begin
        P^ := #0;
        Inc(P);
        P := AnsiStrScan(P, '|');
      end;
    end;
  end;

var
  TempFilter, TempFilename, TempExt: string;
begin
  FFiles.Clear;
  FillChar(OpenFileName, SizeOf(OpenFileName), 0);
  with OpenFilename do
  begin
    if (Win32MajorVersion >= 5and (Win32Platform = VER_PLATFORM_WIN32_NT) or { Win2k }
    ((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) and (Win32MajorVersion >= 4and (Win32MinorVersion >= 90)) then { WinME }
      lStructSize := SizeOf(TOpenFilename)
    else
      lStructSize := SizeOf(TOpenFilename) - (SizeOf(DWORD) shl 1) - SizeOf(Pointer); { subtract size of added fields }

    hInstance := SysInit.HInstance;
    TempFilter := AllocFilterStr(FFilter);
    lpstrFilter := PChar(TempFilter);
    nFilterIndex := FFilterIndex;
    FCurrentFilterIndex := FFilterIndex;
    if ofAllowMultiSelect in FOptions then
      nMaxFile := MultiSelectBufferSize else
      nMaxFile := MAX_PATH;
    SetLength(TempFilename, nMaxFile + 2);
    lpstrFile := PChar(TempFilename);
    FillChar(lpstrFile^, nMaxFile + 20);
    StrLCopy(lpstrFile, PChar(FFileName), nMaxFile);
    if (FInitialDir = ''and ForceCurrentDirectory then
      lpstrInitialDir := '.'
    else
      lpstrInitialDir := PChar(FInitialDir);
    lpstrTitle := PChar(FTitle);
    Flags := OFN_ENABLEHOOK;
    FlagsEx := 0;

    for Option := Low(Option) to High(Option) do
      if Option in FOptions then
        Flags := Flags or OpenOptions[Option];
    if NewStyleControls then
    begin
      Flags := Flags xor OFN_EXPLORER;
      if (Win32MajorVersion >= 5and (Win32Platform = VER_PLATFORM_WIN32_NT) or { Win2k }
      ((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) and (Win32MajorVersion >= 4and (Win32MinorVersion >= 90)) then { WinME }
        for OptionEx := Low(OptionEx) to High(OptionEx) do
          if OptionEx in FOptionsEx then
            FlagsEx := FlagsEx or OpenOptionsEx[OptionEx]; 
    end
    else
      Flags := Flags and not OFN_EXPLORER;
    TempExt := FDefaultExt;
    if (TempExt = ''and (Flags and OFN_EXPLORER = 0then
    begin
      TempExt := ExtractFileExt(FFilename);
      Delete(TempExt, 11);
    end;
    if TempExt <> '' then lpstrDefExt := PChar(TempExt);
    if (ofOldStyleDialog in Options) or not NewStyleControls then
      lpfnHook := DialogHook
    else
      lpfnHook := ExplorerHook;

    if Template <> nil then
    begin
      Flags := Flags or OFN_ENABLETEMPLATE;
      lpTemplateName := Template;
    end;
    hWndOwner := Application.Handle;
    Result := TaskModalDialog(Func, OpenFileName);
    if Result then
    begin
      GetFileNames(OpenFilename);
      if (Flags and OFN_EXTENSIONDIFFERENT) <> 0 then
        Include(FOptions, ofExtensionDifferent) else
        Exclude(FOptions, ofExtensionDifferent);
      if (Flags and OFN_READONLY) <> 0 then
        Include(FOptions, ofReadOnly) else
        Exclude(FOptions, ofReadOnly);
      FFilterIndex := nFilterIndex;
    end;
  end;
end;
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: Di 22.09.09 11:21 
Es kann im Grunde nur die Zeile sein, in der der Dialog tatsächlich angezeigt wird. Denn die Vorbereitung passiert vorher, die Auswertung danach. Der Fehler passiert aber ja während der Dialog sichtbar ist. :nixweiss:
Wobei die Frage ist, ob da irgendein Callback dazwischenfunkt oder sowas.

Da ich das Problem durch eine Wiederherstellung des Backups wieder behoben hatte (und mittlerweile XP auch gar nicht mehr einsetze), kann ich das nachträglich auch nicht mehr untersuchen.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Di 22.09.09 11:27 
Achso ;) ich hatte verstanden das es im Execute selbst abbricht. Jetzt nochmal nachgelesen.... okay dann ist das natürlich was anderes.