Programming/Delphi

윈도우 각종 폴더 경로 얻기

통통만두 2010. 6. 30. 15:22
반응형
// Uses에 ShlObj, ShellApi 추가 
function GetFolderPath(iFolder : Integer) : String;
var
  iID : PItemIDList;
  szPath : PChar;
begin
  Result := ``;
  szPath := StrAlloc(MAX_PATH);
  if SHGetSpecialFolderLocation(Application.Handle, iFolder, iID)
     = NOERROR then
  begina
    SHGetPathFromIDList(iID, szPath);
    Result := StrPas(szPath);
  end;
  StrDispose(szPath);
end;
반응형