Parsi Coders
سورس کد تشخیص 64 بیتی بودن سیستم عامل (ویژوال بیسیک6) - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Visual Basic Programming (http://parsicoders.com/forumdisplay.php?fid=39)
+---- انجمن: Visual Basic 6 (http://parsicoders.com/forumdisplay.php?fid=44)
+---- موضوع: سورس کد تشخیص 64 بیتی بودن سیستم عامل (ویژوال بیسیک6) (/showthread.php?tid=2428)



سورس کد تشخیص 64 بیتی بودن سیستم عامل (ویژوال بیسیک6) - Amin_Mansouri - 06-16-2012

با سورس زیر که با زبان ویژوال بیسیک 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