![]() |
Runtime error 216 at 77D18C2C
hallo,
woher kommt obiger fehler? auf jedenfall wird dieser durch folgendes ausgelöst:
Delphi-Quellcode:
hFile := CreateFile(PChar(pfad),
GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, 0, 0 ); ReadFile(hFile, buf, SizeOf(buf), NumberOfBytesRead, nil); MessageBox(0, PChar(string(NumberOfBytesRead)), 'hi', 0); |
Re: Runtime error 216 at 77D18C2C
Ist buf in der erforderlichen Größe bereitgestellt??
|
Re: Runtime error 216 at 77D18C2C
Ein Runtime Error 216 ist eine Zugriffsverletzung. Hast u für Deinen Buffer genug Speicher reserviert?
Gruß, teebee |
Re: Runtime error 216 at 77D18C2C
hallo,
der buffer sah so aus:
Delphi-Quellcode:
buf: Array[0..4095] of Char;
aber selbst wenn ich " buf: Array[0..1000000000] of Char;" nehme (was ziemlich lagt :D) kommt der fehler.. |
Re: Runtime error 216 at 77D18C2C
Hast Du schon mal überprüft, ob handle <> NIL ist? Vielleicht solltest Du auch noch ein Typecast auf die Winapi32-Typen machen.
|
Re: Runtime error 216 at 77D18C2C
Code:
if (hFile <> 0) then messagebox(0, 'hi', 'hi', 0);
die message wird ausgegeben, also existiert das handle. was meinst du mit api typen? |
Re: Runtime error 216 at 77D18C2C
[equote="In den MS Win32 Developer's References steht geschrieben"]HANDLE CreateFile(
LPCTSTR lpFileName, // pointer to name of the file DWORD dwDesiredAccess, // access (read-write) mode DWORD dwShareMode, // share mode LPSECURITY_ATTRIBUTES lpSecurityAttributes, // pointer to security attributes DWORD dwCreationDistribution, // how to create DWORD dwFlagsAndAttributes, // file attributes HANDLE hTemplateFile // handle to file with attributes to copy );[/equote] |
Re: Runtime error 216 at 77D18C2C
Hallo Pseudemys Nelsoni,
CreateFile gibt bei einem fehlerhaften Handle Zitat:
Delphi-Quellcode:
oder auf -1 und nicht auf 0 prüfen.
IF hFile = INVALID_HANDLE_VALUE THEN
// Fehler |
Re: Runtime error 216 at 77D18C2C
und wie zeig ich das als string an r_kerber?
btw:
Delphi-Quellcode:
´
if (hFile <> INVALID_HANDLE_VALUE) then messagebox(0, 'hi', 'hi', 0);
zeigt ebenfalls die messagebox will nur solch nen doofen string in einer dll ersetzen, man ist das schwer |
Re: Runtime error 216 at 77D18C2C
Zitat:
![]() Stichwort: NumberOfBytesRead (=Gelesen von Luckie) ist vom Typ ...) |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:41 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz