ExtractShortPathName ' Den Dönen Değeri Long Hale Getirme???

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
cLaW
Üye
Mesajlar: 46
Kayıt: 06 Eki 2008 02:16

ExtractShortPathName ' Den Dönen Değeri Long Hale Getirme???

Mesaj gönderen cLaW »

s.a Kısaltılmış Dizinleri Normal uzun hale nasıl getiririz yani ExtractShortPath Den Dönen Değer Gibi Dizinleri Nasıl Uzun Normal Haline Getirebiliriz ?
Kullanıcı avatarı
mrmarman
Üye
Mesajlar: 4741
Kayıt: 09 Ara 2003 08:13
Konum: İstanbul
İletişim:

Re: ExtractShortPathName ' Den Dönen Değeri Long Hale Getirme???

Mesaj gönderen mrmarman »

Torry NET adresinden alıntıdır. ref: http://www.swissdelphicenter.ch/torry/s ... hp?id=1928

Kod: Tümünü seç

function GetLongPathName(const ShortName : string) : string;
var
  pcBuffer: PChar;
  iHandle, iLen : Integer;
  GetLongPathName: function (ShortPathName: PChar; LongPathName: PChar;
                             cchBuffer: Integer): Integer stdcall;
begin
  Result := ShortName;

  iHandle := GetModuleHandle('kernel32.dll');
  if (iHandle <> 0) then begin
    @GetLongPathName := GetProcAddress(iHandle, 'GetLongPathNameA');

    if Assigned(GetLongPathName) then begin
      pcBuffer := StrAlloc(MAX_PATH + 1);
      iLen := GetLongPathName(PChar(ShortName), pcBuffer, MAX_PATH);

      // if result = 0 : conversion failed
      // if result > MAX_PATH ==> conversion failed, buffer not large enough
      if (iLen > 0) and (iLen <= MAX_PATH) then begin
        Result := StrPas(pcBuffer);
      end;  // if (iLen <= MAX_PATH) then
      StrDispose(pcBuffer);
    end;  // if Assigned(GetLongPathName) then
    FreeLibrary(iHandle);
  end;  // if (iHandle <> 0) then
end;
Resim
Resim ....Resim
cLaW
Üye
Mesajlar: 46
Kayıt: 06 Eki 2008 02:16

Re: ExtractShortPathName ' Den Dönen Değeri Long Hale Getirme???

Mesaj gönderen cLaW »

mrmarman yazdı:Torry NET adresinden alıntıdır. ref: http://www.swissdelphicenter.ch/torry/s ... hp?id=1928

Kod: Tümünü seç

function GetLongPathName(const ShortName : string) : string;
var
  pcBuffer: PChar;
  iHandle, iLen : Integer;
  GetLongPathName: function (ShortPathName: PChar; LongPathName: PChar;
                             cchBuffer: Integer): Integer stdcall;
begin
  Result := ShortName;

  iHandle := GetModuleHandle('kernel32.dll');
  if (iHandle <> 0) then begin
    @GetLongPathName := GetProcAddress(iHandle, 'GetLongPathNameA');

    if Assigned(GetLongPathName) then begin
      pcBuffer := StrAlloc(MAX_PATH + 1);
      iLen := GetLongPathName(PChar(ShortName), pcBuffer, MAX_PATH);

      // if result = 0 : conversion failed
      // if result > MAX_PATH ==> conversion failed, buffer not large enough
      if (iLen > 0) and (iLen <= MAX_PATH) then begin
        Result := StrPas(pcBuffer);
      end;  // if (iLen <= MAX_PATH) then
      StrDispose(pcBuffer);
    end;  // if Assigned(GetLongPathName) then
    FreeLibrary(iHandle);
  end;  // if (iHandle <> 0) then
end;
Allah razı olsun hocam aramayı bulmayı bilmediğimizden durum bu :oops:
Cevapla