Arsip: Sepele tapi GAGAL!!

 
user image
more 15 years ago

fcomputer

Haduwh2, nie q ada permasalahan tentang bagaimana cara merubah Long FileName ke ShortFileName (DOS), dah Q cari2 n nemu code ini, tapi waktu Q coba tetep gag bisa, apa ada yang salah?? Delphi saya 7.0

function GetShortName (const FileName: string): string;
var aTmp: array[0..255] of char;
begin
  if not FileExists (FileName) then
    Result := ''
  else if GetShortPathName (PChar (FileName), aTmp, Sizeof (aTmp) - 1) = 0
  then
    Result:= FileName
  else
    Result:= StrPas (aTmp);
end;
user image
more 15 years ago

pebbie

kok pake sizeof? bukannya pake length?
user image
more 15 years ago

fcomputer

Mungkin kayag gini??

function GetShortName(sLongName: string): string; 
var 
  sShortName:    string; 
  nShortNameLen: Integer; 
begin 
  SetLength(sShortName, MAX_PATH); 
  nShortNameLen := GetShortPathName(PChar(sLongName), PChar(sShortName), MAX_PATH - 1); 
  if (0 = nShortNameLen) then 
  begin 
  showmessage('Error!'); 
  end; 
  SetLength(sShortName, nShortNameLen); 
  Result := sShortName; 
end;
user image
more 15 years ago

fcomputer

Ini juga gagal..
user image
more 15 years ago

safari

Coba aja Gogling ini: http://www.google.co.id/#hl=id&source=hp&q=Short+Filename+Delphi&btnG=Telusuri+dengan+Google&meta=&aq=f&oq=Short+Filename+Delphi&fp=ead79af733d7a7f8
user image
more 15 years ago

aday-gate

pake fungsi "extractfilename" ajah coba... :? javascript:emoticon(':?')
user image
more 15 years ago

Penjahat

kedua fungsi milik fcomputer itu kukira bener semua. Tapi sayang fcomputer tidak menjelaskan yg dimaksud dengan gagal. coba lebih spesifik, mungkin nanti ada yg bisa bantu. Cantumkan juga apa isi dari parameter sLongName pada kasus anda , dan berapa nilai kembalian dari fungsi API GetShortPathName()
user image
more 15 years ago

DelphiExpert

Fungsi ini telah ada di SysUtils.pas

uses SysUtils;
// berikut cuplikannya
function ExtractShortPathName(const FileName: string): string;
var
  Buffer: array of Char;
begin
  SetString(Result, Buffer,
    GetShortPathName(PChar(FileName), Buffer, SizeOf(Buffer)));
end;
more ...
  • Pages:
  • 1
Share to

AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com