Autor Beitrag
mandras
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 429
Erhaltene Danke: 107

Win 10
Delphi 6 Prof, Delphi 10.4 Prof
BeitragVerfasst: So 18.03.12 01:44 
ich habe in Erinnerung daß eine Windows-API-Funktion existiert mit der man feststellen kann ob eine Datei, gegeben durch Pfad+Namen, lokal oder im Netzwerk ist.

Leider ist mir entfallen wie diese Funtion heißt. Kann mir diesbzgl. jemand weiterhelfen?

lmgtfy habe ich schon probiert, also bitte keine Hinweise in dieser Art. Passende Suchbegriffe wären natürlich willkommen.

Danke im Voraus,

Andreas
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: So 18.03.12 01:54 
ExpandUNCFilename?

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS

Für diesen Beitrag haben gedankt: mandras
mandras Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 429
Erhaltene Danke: 107

Win 10
Delphi 6 Prof, Delphi 10.4 Prof
BeitragVerfasst: So 18.03.12 01:58 
Das würde wenn ich es richtig verstanden habe zu folgendem führen:

Sobald ExpandUNCFilename etwas mit "\\" am Anfang zurückliefert ist klar daß es ein Netzwerk-share ist
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: So 18.03.12 02:06 
ja, suchst Du etwas anderes?

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 18.03.12 03:36 
Ich würde es besser direkt abfragen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
function IsNetworkFile(const AFilename: string): Boolean;
var
  Size: LongWord;
  Dummy: array[0..1023of Byte;
begin
  Size := SizeOf(Dummy);
  Result := WNetGetUniversalName(PChar(AFilename), UNIVERSAL_NAME_INFO_LEVEL, @Dummy, Size) = NO_ERROR;
end;
// EDIT: Ja, = statt <>


Zuletzt bearbeitet von jaenicke am So 18.03.12 15:32, insgesamt 1-mal bearbeitet

Für diesen Beitrag haben gedankt: mandras
mandras Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 429
Erhaltene Danke: 107

Win 10
Delphi 6 Prof, Delphi 10.4 Prof
BeitragVerfasst: So 18.03.12 14:56 
Danke bummi, jaenicke!

jaenicke, es klappt wenn ich statt <> ein = verwende.

Wobei ich vorher noch prüfen muß ob die angegebene Datei überhaupt existert da die WNetGetUniversalName keinen Fehler meldet solange nur die anfänglichen Pfadangaben korrekt sind.

Das konkrete Ergebnis meiner Arbeiten werde ich unter OpenSource Units einstellen.