728x90
uses
shlObj;
SHGetSpecialFolderPath([핸들], [리턴받을 경로], [찾을 폴더명], [생성여부]
이 함수에서 찾을 폴더명(CSIDL)을 아래 링크를 참조하여 찾아보면 된다
사용 예시)
function GetWindowsPath(nCSIDL): String;
var
P: array [0..MAX_PATH] of Char;
begin
if SHGetSpecialFolderPath(0, @P[0], nCSIDL, True) then Result := P
else Result := '';
end;
sAppdataPath := GetWindowsPath(CSIDL_APPDATA);
sProgramPath := GetWindowsPath(CSIDL_PROGRAM_FILES);
위와같이 함수를 복붙해서 만들어놓고 쓰면 편하다
CSIDL값 참조는 아래링크
https://docs.microsoft.com/en-us/windows/win32/shell/csidl
※추가로 과거에는 SHGetSpecialFolderPath 함수가 아닌 SHGetFolderPath를 사용했는데
windows vista와 7이후 부터는 SHGetSpecialFolderPath 함수를 사용해야 정확한 Path를 가져 올 수 있다고 한다
(정확하진않지만 program files, program files (x86), programdata 등을 얘기하는건 아닐까 싶다)
728x90
'운동하는 개발자 > Delphi' 카테고리의 다른 글
델파이 크리티컬세션 사용법 / delphi criticalsection (for multiThread) (0) | 2021.11.17 |
---|---|
델파이 windows10 한글 깨짐 / edit 창 한글 커서 오류 (d2codingfont) (0) | 2021.09.23 |
델파이 DBXJSON를 이용한 json 생성 / how to make json at delphi (DBXJSON) (0) | 2021.08.17 |
델파이 idhttp 에러메세지 내용 확인 / idhttp error message (0) | 2021.07.06 |
델파이 JSON String 파싱 / delphi json parsing (0) | 2021.07.02 |