Detect 64 bit operating system - Visual Basic 6
Spider Harper
A function to determine if the windows operating system is 64 bit.
Private Declare Function GetProcAddress Lib "kernel32" _
(ByVal hModule As Long, _
ByVal lpProcName As String) As Long
Private Declare Function GetModuleHandle Lib "kernel32" _
Alias "GetModuleHandleA" _
(ByVal lpModuleName As String) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" _
() As Long
Private Declare Function IsWow64Process Lib "kernel32" _
(ByVal hProc As Long, _
bWow64Process As Boolean) As Long
Public Function Is64bit() As Boolean
Dim handle As Long, bolFunc As Boolean
' Assume initially that this is not a Wow64 process
bolFunc = False
' Now check to see if IsWow64Process function exists
handle = GetProcAddress(GetModuleHandle _
("kernel32"), "IsWow64Process")
If handle > 0 Then ' IsWow64Process function exists
' Now use the function to determine if
' we are running under Wow64.
IsWow64Process GetCurrentProcess(), bolFunc
End If
Is64bit = bolFunc
End Function
