탐색기에서 파일을 더블클릭하면 연결된 프로그램이 동작하게 되는데,
이는 레지스트리에 정보가 기록되어 있기 때문입니다.
아래 팁은 파일의 확장자로 연결된 응용 프로그램이 무엇인지 알아내는 방법입니다.
(출처) http://delphi.about.com
Uses Registry;
function GetExeByExtension(sExt : string) : string;
var
sExtDesc:string;
begin
with TRegistry.Create do
begin
try
RootKey:=HKEY_CLASSES_ROOT;
if OpenKeyReadOnly(sExt) then
begin
sExtDesc:=ReadString('') ;
CloseKey;
end;
if sExtDesc <>'' then
begin
if OpenKeyReadOnly(sExtDesc + '\Shell\Open\Command') then
begin
Result:= ReadString('') ;
end
end;
finally
Free;
end;
end;
if Result <> '' then
begin
if Result[1] = '"' then
begin
Result:=Copy(Result,2,-1 + Pos('"',Copy(Result,2,MaxINt))) ;
end
end;
end;
|