큰꼼의 세상

짧은 파일명과 긴 파일명 구하기

짧은 파일명 구하는 함수
Function GetShortFileName(Const FileName : String) : String;
var
    aTmp: array[0..255] of char;
begin
    if GetShortPathName(PChar(FileName),aTmp,Sizeof(aTmp)-1)=0 then
        Result:= FileName
    else
        Result:=StrPas(aTmp);
end;

긴파일명 구하는 함수
Function GetLongFileName(Const FileName : String) : String;
var
    aInfo: TSHFileInfo;
begin
    if SHGetFileInfo(PChar(FileName),0,aInfo,Sizeof(aInfo),SHGFI_DISPLAYNAME)<>0 then
        Result:= String(aInfo.szDisplayName)
    else
        Result:= FileName;
end;