Determine the bitness of the program: 16-bit DOS, 16-bit Windows, 32-bit Windows, 64-bit Windows.
1 2 3 4 5 6 7 8 |
var path: WideString; res: string; begin path:= 'C:\Windows\notepad.exe'; res:= getFilePlatfotm(path); ShowMessage(res); end; |
Options
path - application path
Result
A string describing the bit width, or an empty string in case of: failure, missing file, if the file is not a DOS or Windows application.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function getFilePlatfotm(path: string): string; var bt: Cardinal; begin result:= ''; if GetBinaryType(PChar(path), bt) then case bt of SCS_DOS_BINARY : result := '16-bit DOS'; SCS_WOW_BINARY : result := '16-bit Windows'; SCS_32BIT_BINARY : result := '32-bit'; SCS_64BIT_BINARY : result := '64-bit'; end; end; |