Autor Beitrag
Robii
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: So 31.05.09 01:15 
Hallöchen,

wenn ich folgenden Code benutze
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:
procedure TForm3.Button1Click(Sender: TObject);
var

Datei: Textfile;
begin

If Wp_AD_1.checked = true
Then
begin
AssignFile(Datei, ExtractFilePath(Application.ExeName) + 'WP_SH.SET');
Rewrite(Datei);
try
WriteLn(Datei,'1');
finally
CloseFile(Datei);
end;

end
else begin
  if Wp_AD_2.checked = true
  then begin
  AssignFile(Datei, ExtractFilePath(Application.ExeName) + 'WP_SH.SET');
Rewrite(Datei);
try
WriteLn(Datei, '0');
finally
CloseFile(Datei);

  end
  end

end;
end;

benutze stürtzt mein Programm immer ab und meldet den Fehler: E/A-Fehler 32 !

Wieso? Vorhin, hat es noch geklappt.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 31.05.09 01:38 
Der Fehler besagt, dass die Datei noch geöffnet ist, irgendein Programm also noch darauf zugreift.

Wenn du nicht weißt welches, dann kannst du das mit dem Process Explorer herausfinden (nach der Datei suchen via Menü).
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: So 31.05.09 08:32 
Wenn ich das jetzt gerade richtig sehe, kann die Datei doch aber auch schreibgeschützt sein.
- Oder gibt es da einen anderen Rückgabewert?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 31.05.09 14:39 
Wie du der Liste der Fehlercodes leicht entnehmen kannst, ist dem nicht so.
System Error Codes hat folgendes geschrieben:
ERROR_SHARING_VIOLATION - 32 (0x20):
The process cannot access the file because it is being used by another process.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: So 31.05.09 14:51 
E.: Hatte vergessen die Datei vorher zu schliessen,
wenn ich sie bei OnShow abfrage. Danke für die Hilfe.

Grüße.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19321
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 31.05.09 14:54 
Das dachte ich mir, dann ist der Fehler typisch. Allerdings war das im geposteten Code eben nicht zu sehen. ;-)