How can i write a visual basic code that determines the system type?

I’m trying to write a visual basic 2008 program that can determine if it is on a 32-bit or 64-bit operating system. Any ideas on how i could begin? Code or sources are greatly appreciated.
Thanks in advance.

2 Responses to “How can i write a visual basic code that determines the system type?”

  • dhvrm:

    You can use IntPtr.Size to get the number of bits of the OS that is currently running.

    Dim size as Integer = IntPtr.Size ‘ 4 = 32 bit, 8 = 64 bit

  • Player:

    Set WshShell = CreateObject("WScript.Shell")
    X = WshShell.RegRead("HKLM\SYSTEM\Current
    ControlSet\Control\Session Manager\Environment\
    PROCESSOR_ARCHITECTURE")
    If X = "x86" Then
    MsgBox "32-bit"
    Else
    MsgBox "64-bit"
    End If

Leave a Reply