Files Delphi

function GetEXEType(FileName: string): string;
var
BinaryType: DWORD;
begin
if GetBinaryType(PChar(FileName), Binarytype) then
case BinaryType of
SCS_32BIT_BINARY: Result := 'Win32 executable';
SCS_DOS_BINARY: Result := 'DOS executable';
SCS_WOW_BINARY: Result := 'Win16 executable';
SCS_PIF_BINARY: Result := 'PIF file';
SCS_POSIX_BINARY: Result := 'POSIX executable';
SCS_OS216_BINARY: Result := 'OS/2 16 bit executable'
else
Result := 'unknown executable'
end
else
Result := 'File is not an executable';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption := GetEXEType('c:\windows\notepad.exe');
end;