I'm trying to use the API calls to get the bitness of Excel, and I'm using the following code, which fails on the GetBinaryType call.
Any ideas?
Thanks,
PROGRAM TEST
IMPLICIT NONE
LOGICAL :: Is64Bit
Is64Bit = Is64BitExcel()
Write(*,*) Is64Bit
CONTAINS
LOGICAL function Is64BitExcel
USE KERNEL32
USE IFWINTY
USE WINTERACTER
IMPLICIT NONE
INTEGER(BOOL) :: ret
CHARACTER(LEN=MAX_PATH) :: ExcelPath
Integer(DWORD) :: BinaryType
Integer :: iLen
is64BitExcel = .FALSE.
CALL IOsRegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe", &
excelPath, "Path", Length=iLen)
if (iLen>0) THEN
excelPath(iLen+1:)="excel.exe"
ret=GetBinaryType(excelPath, binaryType) !ret always zero, so file not found or not executable!
IS64BITExcel = (binaryType == SCS_32BIT_BINARY)
end if
end function Is64BitExcel
end program TEST