I want vb6 code to check OS is 32 bit or 64 bit and also processor is 32 bit or 64 bit.So please help me to get these codes. In vb.net i can use Environment.Is64BitOperating
The most straightforward way to answer both questions seems to be using Win32_Processor WMI class.
For operating system one can check AddressWidth property:
AddressWidth
On a 32-bit operating system, the value is 32 and on a 64-bit operating system it is 64.
Relevant VB6 code is:
Public Function GetOsBitness() As String
Dim ProcessorSet As Object
Dim CPU As Object
Set ProcessorSet = GetObject("Winmgmts:"). _
ExecQuery("SELECT * FROM Win32_Processor")
For Each CPU In ProcessorSet
GetOsBitness = CStr(CPU.AddressWidth)
Next
End Function
For processor one can check DataWidth property:
DataWidth
On a 32-bit processor, the value is 32 and on a 64-bit processor it is 64.
Relevant VB6 code is:
Public Function GetCpuBitness() As String
Dim ProcessorSet As Object
Dim CPU As Object
Set ProcessorSet = GetObject("Winmgmts:"). _
ExecQuery("SELECT * FROM Win32_Processor")
For Each CPU In ProcessorSet
GetCpuBitness = CStr(CPU.DataWidth)
Next
End Function