PowerBuilder Get Osbit running a 32-bit or 64-bit version of Windows
you can use the Windows API to determine the operating system architecture. Here is some sample code that you can use in PowerBuilder 10.5 to determine the operating system architecture
This code calls the GetNativeSystemInfo Windows API function to retrieve information about the system architecture. It then determines whether the operating system is 32-bit or 64-bit, and displays a message box with the result. Note that this code only works on Windows operating systems, and may not work on other platforms.
SYSTEM_INFO is a structure in the Windows API that contains information about the current computer system. It is defined in the “WinNT.h” header file and contains the following members:
wProcessorArchitecture: An integer value that specifies the processor architecture of the system. This value can be one of the following:
PROCESSOR_ARCHITECTURE_INTEL(0): The system has an x86 processor.
PROCESSOR_ARCHITECTURE_IA64(6): The system has an Intel Itanium processor.
PROCESSOR_ARCHITECTURE_AMD64(9): The system has an x64 processor.
wReserved: This member is reserved for future use and should be set to 0.
dwPageSize: The page size and allocation granularity of the system, in bytes.
lpMinimumApplicationAddress: A pointer to the lowest memory address accessible to applications and dynamic-link libraries (DLLs).
lpMaximumApplicationAddress: A pointer to the highest memory address accessible to applications and DLLs.
dwActiveProcessorMask: A mask that specifies the set of processors that are currently available for use.
dwNumberOfProcessors: The number of processors in the system.
dwProcessorType: An integer value that specifies the type of processor in the system.
dwAllocationGranularity: The allocation granularity of memory, in bytes.
wProcessorLevel: The level of the processor in the system.
wProcessorRevision: The revision number of the processor.
You can use the
GetNativeSystemInfo() function in the Windows API to retrieve a
SYSTEM_INFO structure containing information about the current system.
// Define structure SYSTEM_INFO
type SYSTEM_INFO from structure
// Declare variables
// Call the GetNativeSystemInfo Windows API function
function ulong GetNativeSystemInfo(ref SYSTEM_INFO lpSystemInfo) library "kernel32.dll"
// Determine the operating system architecture
li_architecture = ls_sysinfo.wProcessorArchitecture
if li_architecture = 0 then
ul_platform = 32 // 32-bit architecture
ul_platform = 64 // 64-bit architecture
// Display the operating system architecture
if ul_platform = 32 then
MessageBox("Operating System Architecture", "This is a 32-bit version of Windows.")
MessageBox("Operating System Architecture", "This is a 64-bit version of Windows.")