试过用program files (X86) 这个目录做判断,感觉不是很专业,有这方面的API吗?

解决方案 »

  1.   

    应该没有 不过应该可以看CPU是32(X86)还是64(X64)的
      

  2.   

    我知道64bit的注册表多了一层什么东东,具体的不记得了,可以上网查查还有就是 run那里运行winver
    这个命令可以返回很多信息不在程序边上不知道啊
      

  3.   

    CPU现在基本上是64位的 可很多装的是32位系统 WINVER 直接跳了个对话框出来
      

  4.   

    GetNativeSystemInfo可以取,不过没VB的代码,那结构还麻烦
    另外估计是有个简单的方法,
    我的是64位,ntdll中导出了一个函数ZwWow64ReadVirtualMemory64
    我猜想32位不可能会有这么个函数吧
    所以用下面的代码应该是没问题的Dim hMod as Long
    hMod=GetModuleHandle("ntdll.dll")
    if GetProcAddress(hMod,"ZwWow64ReadVirtualMemory64" Then
       MsgBox "64位"
    else
       MsgBox "32位"
    end if
    另C++代码使用GetNativeSystemInfo:LPSYSTEM_INFO lpSystemInfo=new SYSTEM_INFO; 
    GetNativeSystemInfo(lpSystemInfo);
    if (lpSystemInfo->wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)//这个地方的常数值挺多的,但我的Inter 64位是这个值
    //64位
    else
    //32位
    //-------------------------
    delete lpSystemInfo;
      

  5.   

    Option Explicit
    Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
    Private Declare Function IsWow64Process Lib "kernel32" (ByVal hProcess As Long, ByRef Wow64Process As Long) As Long
     
    Private Sub Command1_Click()
        Dim lngReturn As Long
        Call IsWow64Process(GetCurrentProcess, lngReturn)
        If lngReturn = 0 Then
            MsgBox "非64位OS"
        Else
            MsgBox "64位OS"
        End If
    End Sub
      

  6.   

    这份代码貌似是用来判断当前进程是否是64位的.最后判断貌似也反了了-_-!
    http://blog.csdn.net/SilenceNet/archive/2010/12/19/6085576.aspx
      

  7.   

    以下是MSDN的解释:
    IsWow64Process Function 
    Determines whether the specified process is running under WOW64.
     
    Syntax
     Copy
    BOOL WINAPI IsWow64Process(
      __in   HANDLE hProcess,
      __out  PBOOL Wow64Process
    );
     
    Parameters
     hProcess [in] 
    A handle to the process. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights.
     Windows Server 2003 and Windows XP:  The handle must have the PROCESS_QUERY_INFORMATION access right.
     Wow64Process [out] 
    A pointer to a value that is set to TRUE if the process is running under WOW64. If the process is running under 32-bit Windows, the value is set to FALSE. If the process is a 64-bit application running under 64-bit Windows, the value is also set to FALSE.
     
    Return Value
     
    If the function succeeds, the return value is a nonzero value.
     
    If the function fails, the return value is zero. To get extended error information, call GetLastError.
     
      

  8.   

    取得岂今为止最全面的Windows版本和IE版本以及32位和64位操作系统信息
    http://blog.csdn.net/chenjl1031/archive/2011/04/13/6320254.aspx
      

  9.   

    Windows 7 有32和64位两种版本,如果是正版的话,只能安装一种版本.
      

  10.   

    To:12楼
    最新出炉...VB6判断进程是否是64位.[WIN7 X64下测试通过.]
    http://blog.csdn.net/SilenceNet/archive/2011/05/30/6455748.aspx
    -_- E文我翻译了好一会,没看太明白的,
    返回值也只能说明成功返回非零值呀..
    我刚特意到32位的XP试了下
    IsWow64Process在正常情况下是返回非零值的
    ...
    改天再写VB6判断X64系统的.GetNativeSystemInfo
      

  11.   

    我把14楼的识别32位和64位操作系统的相关代码提了出来:Option ExplicitPrivate Declare Function GetModuleHandle _
                    Lib "kernel32" _
                    Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
    Private Declare Function LoadLibraryEx _
                   Lib "kernel32" _
                   Alias "LoadLibraryExA" (ByVal lpLibFileName As String, _
                                           ByVal hFile As Long, _
                                           ByVal dwFlags As Long) As Long
    Private Declare Function GetProcAddress _
                   Lib "kernel32" (ByVal hModule As Long, _
                                   ByVal lpProcName As String) As Long
    Private Declare Function FreeLibrary _
                   Lib "kernel32" (ByVal hLibModule As Long) As Long
    Private Const DONT_RESOLVE_DLL_REFERENCES As Long = &H1
    Private Type SYSTEM_INFO
        wProcessorArchitecture As Integer
        wReserved As Integer
        dwPageSize As Long
        lpMinimumApplicationAddress As Long
        lpMaximumApplicationAddress As Long
        dwActiveProcessorMask As Long
        dwNumberOfProcessors As Long
        dwProcessorType As Long
        dwAllocationGranularity As Long
        wProcessorLevel As Integer
        wProcessorRevision As Integer
    End TypePrivate Declare Sub GetNativeSystemInfo _
                    Lib "kernel32.dll" (ByRef lpSystemInfo As SYSTEM_INFO)Private Const PROCESSOR_ARCHITECTURE_AMD64 As Long = &H9Private Function APIFunctionPresent(ByVal FunctionName As String, ByVal DLLName As String) As Boolean    Dim lHandle As Long
        Dim lAddr  As Long
        Dim FreeLib As Boolean    FreeLib = False    lHandle = GetModuleHandle(DLLName)    If lHandle = 0 Then
            lHandle = LoadLibraryEx(DLLName, 0&, DONT_RESOLVE_DLL_REFERENCES)
            FreeLib = True
        End If    If lHandle <> 0 Then
            lAddr = GetProcAddress(lHandle, FunctionName)        If FreeLib Then
                FreeLibrary lHandle
            End If
        End If    APIFunctionPresent = (lAddr <> 0)End FunctionPrivate Function InfoVersion64bit() As String    Dim lngRet As Long
        Dim strTemp As String
        Dim Si As SYSTEM_INFO    'blnIsWin64bit = False
    '    If APIFunctionPresent("IsWow64Process", "kernel32") Then
    '        IsWow64Process GetCurrentProcess, lngRet
    '
    '            If lngRet <> 0 Then
        If APIFunctionPresent("GetNativeSystemInfo", "kernel32") Then  'N'existe qu'?partir d'XP => v閞if au cas o?2000 demande
            GetNativeSystemInfo Si
            If Si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 Then
                    strTemp = "Windows for 64bits"
                    'blnIsWin64bit = True
            Else
                    strTemp = "Windows for 32bits"
                    'blnIsWin64bit = False
            End If
        End If    InfoVersion64bit = strTempEnd FunctionPrivate Sub Form_Load()
        MsgBox (InfoVersion64bit)
    End Sub
      

  12.   

    batch
    systeminfo.exe /FO LIST | find /I "x86-based PC"
    systeminfo.exe /FO LIST | find /I "x64-based PC"vbsOn Error Resume Next
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)For Each objItem in colItems
     WScript.Echo objItem.CreationClassName
    Next