2013년 1월 18일 금요일

특정 폴더 찾기


uses WinApi.Shlobj, ActiveX;

procedure TForm2.Button1Click(Sender: TObject);
var
  PIDL: PItemIDList;
  // Path: String;
  Path: PChar;
  Folder: integer;
  AMalloc: IMalloc;
begin
  Folder:= CSIDL_INTERNET_CACHE;
  // SetLength(Path,MAX_PATH);
  Path:= StrAlloc(Max_Path);
  SHGetSpecialFolderLocation(Application.Handle, Folder, PIDL);
  // if SHGetPathFromIDList(PIDL, pChar(Path)) then
  if SHGetPathFromIDList(PIDL, Path) then
    Edit1.Text:= Path;
  SHGetMalloc(AMalloc);
  StrDispose(Path);
end;

Path 변수를 String 과 PChar 2가지의 방법으로 구현하여 보았습니다.
당연 String 으로 할 경우에는 StrDispose 가 필요없습니다.

댓글 없음:

tensorflow gpu 사용하기에서

 tensorflow 설치시 주의해야 한다. # Anything above 2.10 is not supported on the GPU on Windows Native python - m pip install "tensorflow<2.11...