Autor Beitrag
jerilynn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 22



BeitragVerfasst: Di 19.06.07 18:59 
Hallo,

ich wollte fragen ob jemand eine Unicode fähige FileExists Funktion kennt die auch mit WideStrings (also Unicode Strings) zurecht kommt? Habe bestimmt schon das halbe Internet abgegrast leider ohne Erfolg.


Greez
Lynn
Ghostwalker
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17

Windows XP Prof.
Turbo Delphi 2006, Delphi 7 Prof.
BeitragVerfasst: Di 19.06.07 21:30 
Spontan würd ich sagen dürfte bei der JCL was dabei sein:

http://www.delphi-jedi.org/ ->JCL

_________________
Gruß Ghostwalker
Es gibt keine Probleme, nur noch nicht gefundenen Lösungen
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 19.06.07 22:49 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
function FileExistsW(const FileName: WideString): Boolean;
var
  Attr: Cardinal;
begin
  Attr := GetFileAttributesW(PWideChar(Filename));
  Result := (Attr <> $FFFFFFFFand (Attr and FILE_ATTRIBUTE_DIRECTORY = 0);
end;
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: Mi 20.06.07 07:29 
user profile iconjerilynn hat folgendes geschrieben:
Hallo,

ich wollte fragen ob jemand eine Unicode fähige FileExists Funktion kennt die auch mit WideStrings (also Unicode Strings) zurecht kommt? Habe bestimmt schon das halbe Internet abgegrast leider ohne Erfolg.


Greez
Lynn


Hallo,

die "offizielle" Methode ist wohl FindFirstFileW. Kommentar bei MS:

In the ANSI version of this function, the name is limited to MAX_PATH CHARs. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

Wenn das Ergebnis ein ungültiges Handle ist, existiert die Datei nicht oder ist nicht zugreifbar, was für die Software auf das Gleiche herauskommt.

Gruss Reinhard
jerilynn Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 22



BeitragVerfasst: Mi 20.06.07 15:21 
Dankeschön:) Jetzt funktionierts :)