Autor Beitrag
MasterT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67

Win XP x64, Win 98, Win 2000, Win ME
D6 Prof., Delphi 2006
BeitragVerfasst: Fr 30.07.04 15:05 
Hallo, ich hab ein kleines Problem mit der Funktion GetFullPathName. Ich ermittle den User Tempfolder, allerdings bekomme ich den nur als kurzen Pfad zurück, also so: C:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\. Nun will ich aus dem kurzen Pfad einen langen machen, weil ich einen Stringvergleich damit durchführen will/muss. Ich nutze dafür, oder versuche es zumindest :), die Funktion GetFullPathName. Aber egal wie ich es mache, ich bekomme den FullPathName nicht. Ich bekomme immer nur den kurzen. Hier noch ein kleiner Auschnitt wie ich es mache. Ich hoffe mir kann jemand helfen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function GetLongPathName(ShortName:String):String;
var  NameS: String;
     Len : integer;
     Buffer: array[0..MAX_PATH] of Char;
     pDummy: PCHAR;
begin
     Len := GetFullPathName(PChar(ShortName), 0, PChar(result), pDummy);
     SetLength(NameS, Len);
     GetFullPathName(PChar(ShortName), Len, PChar(NameS), pDummy);

     result := NameS;
end;


P.S.: So hab ich es auch auf mehreren Google Seiten gefunden... ???!!!

Viele Grüße

MasterT

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.
SvenAbeln
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 334
Erhaltene Danke: 3



BeitragVerfasst: Fr 30.07.04 15:31 
Hallo,

ich glaube du brauchst eine andere Funktion.


Dies habe ich im msdn gefunden
Zitat:

GetFullPathName does no conversion of the specified file name, lpFileName. If the specified file name exists, you can use GetLongPathName and GetShortPathName to convert to long and short path names, respectively.


Also schau dir mal GetLongPathName an.