Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - Общий форум

Страница: 1 |

 

  Вопрос: Как узнать версию Винды(95, ME, Nt, 2000)??? Добавлено: 21.03.03 11:10  

Автор вопроса:  dao

подскажите, плз

Ответить

  Ответы Всего ответов: 2  

Номер ответа: 1
Автор ответа:
 dao



Вопросов: 1
Ответов: 1
 Профиль | | #1 Добавлено: 21.03.03 16:15

т.е. узнать програмным способом в какой винде запущена программа(VB6)

Ответить

Номер ответа: 2
Автор ответа:
 P



ICQ: 346632205 

Вопросов: 5
Ответов: 86
 Профиль | | #2 Добавлено: 22.03.03 05:08

Вот статья, взятая с этого сайта:

Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (LpVersionInformation As OSVERSIONINFO) As Long
Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)
Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Const PROCESSOR_INTEL_386 = 386
Const PROCESSOR_INTEL_486 = 486
Const PROCESSOR_INTEL_PENTIUM = 586
Const PROCESSOR_MIPS_R4000 = 4000
Const PROCESSOR_ALPHA_21064 = 21064
Sub SystemInformation()
Dim msg As String ' Status information.
Dim NewLine As String ' New-line.
Dim ret As Integer ' OS Information
Dim ver_major As Integer ' OS Version
Dim ver_minor As Integer ' Minor Os Version
Dim Build As Long ' OS Build
NewLine = Chr(13) + Chr(10) ' New-line.
' Get operating system and version.
Dim verinfo As OSVERSIONINFO
verinfo.dwOSVersionInfoSize = Len(verinfo)
ret = GetVersionEx(verinfo)
If ret = 0 Then
MsgBox "Error Getting Version Information"
End
End If
'MsgBox verinfo.dwPlatformId
Select Case verinfo.dwPlatformId
Case 0
msg = msg + "Windows 32s "
Case 1
msg = msg + "Windows 95 "
Case 2
msg = msg + "Windows NT "
End Select

ver_major = verinfo.dwMajorVersion
ver_minor = verinfo.dwMinorVersion
Build = verinfo.dwBuildNumber
msg = msg & ver_major & "." & ver_minor
msg = msg & " (Build " & Build & ")" & NewLine & NewLine

' Get CPU type and operating mode.
Dim sysinfo As SYSTEM_INFO
GetSystemInfo sysinfo
msg = msg + "CPU: "
'MsgBox sysinfo.dwProcessorType
Select Case sysinfo.dwProcessorType
Case PROCESSOR_INTEL_386
msg = msg + "Intel 386" + NewLine
Case PROCESSOR_INTEL_486
msg = msg + "Intel 486" + NewLine
Case PROCESSOR_INTEL_PENTIUM
msg = msg + "Intel Pentium" + NewLine
Case PROCESSOR_MIPS_R4000
msg = msg + "MIPS R4000" + NewLine
Case PROCESSOR_ALPHA_21064
msg = msg + "DEC Alpha 21064" + NewLine
Case Else
msg = msg + "(unknown)" + NewLine
End Select
msg = msg + NewLine
' Get free memory.
Dim memsts As MEMORYSTATUS
Dim memory As Long
GlobalMemoryStatus memsts
memory = memsts.dwTotalPhys
msg = msg + "Total Physical Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
memory = memsts.dwAvailPhys
msg = msg + "Available Physical Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
memory = memsts.dwTotalVirtual
msg = msg + "Total Virtual Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
memory = memsts.dwAvailVirtual
msg = msg + "Available Virtual Memory: "
msg = msg + Format(memory \ 1024, "###,###,###") + "K" + NewLine
MsgBox msg, vbOKOnly, "System Info"
End Sub

Private Sub Command1_Click()
Call SystemInformation
End Sub

Ответить

Страница: 1 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам