Autor Beitrag
Atreyu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137


Delphi 7 Enterprise
BeitragVerfasst: Mi 28.11.07 21:12 
Ich habe eine Routine in meinem Proggy, dass mir (sofern mit dem dazugehörenden Dateityp verknüpft) den Namen der Datei überliefert und diese Datei so in meinem Proggy verwednet werden kann.

Nur leider liefert der mit jedesmal den verkürzten Dateinamen (C:\MeinOrdner\MEINDA~1 anstelle von C:\MeinOrdner\Mein Dateiname.xyz). Allerdings findet er die Date tatsächlich, nur stimmen eben die Namen nicht, die ich aber brauch.

Wie kann ich den richtigen Filenamen finden?


Moderiert von user profile iconNarses: Topic aus VCL (Visual Component Library) verschoben am Mi 28.11.2007 um 23:25
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mi 28.11.07 21:26 
Hallo,

müsste Deine Delphiversion kennen: ExpandFileName

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Atreyu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137


Delphi 7 Enterprise
BeitragVerfasst: Mi 28.11.07 21:43 
Die steht doch unter meinem Nick...
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: Mi 28.11.07 21:46 
hi

das war ja nicht als Frage formuliert, sondern als konjunktive Feststellung...auf,auf, ans Hackbrett :wink:

_________________
Gruß Aga
Atreyu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137


Delphi 7 Enterprise
BeitragVerfasst: Mi 28.11.07 22:51 
Aso, sorry ^^

Mach ich morgen gleich, heute bin ich zu müde um mich aufzuregen =)

Okay, habs probiert: Fazit: Geht nicht. Er liefert noch das gleiche. Der Pfad ist auch betroffen. Sieht aus, wie damals im DOS-Modus unter Windows, die langen Dateinamen werden einfach ins alte Format gekürzt...
Atreyu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137


Delphi 7 Enterprise
BeitragVerfasst: Do 29.11.07 11:36 
Problem gelöst.
Und da ich immer gern auflöse:

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:
function GetLongPathName(APath:String):String;
var
  i : Integer;
  h : THandle;
  Data : TWin32FindData;
  IsBackSlash : Boolean;
begin
  APath:=ExpandFileName(APath);
  i:=Pos('\',APath);
  Result:=Copy(APath,1,i);
  Delete(APath,1,i);
  repeat
    i:=Pos('\',APath);
    IsBackSlash:=i>0;
    if Not IsBackSlash then 
      i:=Length(APath)+1;
    h:=FindFirstFile(PChar(Result+Copy(APath,1,i-1)),Data);
    if h<>INVALID_HANDLE_VALUE then begin
      try
        Result:=Result+Data.cFileName;
        if IsBackSlash then 
          Result:=Result+'\';
      finally
        Windows.FindClose(h);
      end;
    end
    else begin
      Result:=Result+APath;
      Exit;
    end;
    Delete(APath,1,i);
  until Length(APath)=0;
end; {Peter Haas}


Diese Funktion mag umständlich sein, aber sie funktioniert immerhin!

Moderiert von user profile iconjasocul: Code- durch Delphi-Tags ersetzt
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 29.11.07 11:41 
Bereiche - Delphi - Code markieren und auf + klicken :wink:

ausblenden Delphi-Quelltext
1:
2:
3:
begin
  Delphicode;
end;

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Atreyu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 137


Delphi 7 Enterprise
BeitragVerfasst: Do 29.11.07 12:38 
Danke, wollte ich am Anfang schon wissen.