Parsi Coders

نسخه‌ی کامل: سورس کد تشخیص 64 بیتی بودن سیستم عامل (ویژوال بیسیک6)
شما در حال مشاهده نسخه آرشیو هستید. برای مشاهده نسخه کامل کلیک کنید.
با سورس زیر که با زبان ویژوال بیسیک 6 نوشته شده است میتونید تشخیص بدید ایا سیستم عامل 64 بیتی هست یا خیر؟
english:
This is a simple set of functions to determine if your VB6 (32-bit) code is running on a 64-bit windows operating system, using WOW64. I have tested it on W2K SP4 Server (32-bit), XP Pro (32-Bit) and W2K3 SP1 Server (64-Bit).
Declarations:

کد:
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 LongPrivate 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 = bolFuncEnd Function