PDA

View Full Version : تشخیص نوع ویندوز



شفیعی
سه شنبه 29 اردیبهشت 1383, 20:35 عصر
سلام
چگونه می توان با دستورات VB نوع ویندوز را تشخیص داد یعنی برنامه متوجه شد ویندوز 98 هست یا XP

بابک زواری
چهارشنبه 30 اردیبهشت 1383, 20:25 عصر
آقای شفیعی عزیز سورس کد این برنامه را در صفحات قبل گذاشتم
اگر زحمت نیست میتویند اونو پیدا کنید .
اگر پیدا نکردید مطالب ارایه شده توسط من رو نگاه کنید حتما پیدا خواهید
کرد.
موفق باشید

Voldemort
چهارشنبه 30 اردیبهشت 1383, 22:24 عصر
کتاب VB And API ناشر: انتشارات بنفام. سوال شما و خیلی از سوالات دیگرتان را جواب داده

شفیعی
جمعه 01 خرداد 1383, 21:45 عصر
سلام
دوست عزیز مطلب شما را پیدا نکردم

بابک زواری
یک شنبه 03 خرداد 1383, 19:10 عصر
این کد برای اجرا نیاز به یک ماژول یک فرم که روی آن دو لیبل باشه دارد در کد توضیحات لازمه هست و تمام و یندوزها رو از هم تشخیص میده . ویندوز 95 و 98 و me و NT و 2000 , XP موفق باشید
ادرسش هم توی این تاپیک بود

http://www.barnamenevis.org/forum/viewtopic.php?t=6822



'This example needs a form and a module.
'On the form, their should be two Labels (lbl_operatingplatform
'and lbl_operatingsystem)
'IN A FORM:
Private Sub Form_Load()
Select Case OperatingPlatform
Case Enum_OperatingPlatform.Platform_Windows_32: lbl_operatingplatform.Caption = "Windows 32"
Case Enum_OperatingPlatform.Platform_Windows_95_98_ME: lbl_operatingplatform.Caption = "Windows 95/98/ME"
Case Enum_OperatingPlatform.Platform_Windows_NT_2K_XP: lbl_operatingplatform.Caption = "Windows NT/2K"
End Select
Select Case OperatingSystem
Case System_Windows_32: lbl_operatingsystem.Caption = "Windows 32"
Case System_Windows_95: lbl_operatingsystem.Caption = "Windows 95"
Case System_Windows_98: lbl_operatingsystem.Caption = "Windows 98"
Case System_Windows_ME: lbl_operatingsystem.Caption = "Windows ME"
Case System_Windows_NT: lbl_operatingsystem.Caption = "Windows NT"
Case System_Windows_2K: lbl_operatingsystem.Caption = "Windows 2K"
Case System_Windows_XP: lbl_operatingsystem.Caption = "Windows XP"
End Select
End Sub
'IN A MODULE:
Private Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVERSIONINFO) As Long
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Public Enum Enum_OperatingPlatform
Platform_Windows_32 = 0
Platform_Windows_95_98_ME = 1
Platform_Windows_NT_2K_XP = 2
End Enum
Public Enum Enum_OperatingSystem
System_Windows_32 = 0
System_Windows_95 = 1
System_Windows_98 = 2
System_Windows_ME = 3
System_Windows_NT = 4
System_Windows_2K = 5
System_Windows_XP = 6
End Enum
Public Function OperatingPlatform() As Enum_OperatingPlatform
Dim lpVersionInformation As OSVERSIONINFO
lpVersionInformation.dwOSVersionInfoSize = Len(lpVersionInformation)
Call GetVersionExA(lpVersionInformation)
OperatingPlatform = lpVersionInformation.dwPlatformId
End Function
Public Function OperatingSystem() As Enum_OperatingSystem
Dim lpVersionInformation As OSVERSIONINFO
lpVersionInformation.dwOSVersionInfoSize = Len(lpVersionInformation)
Call GetVersionExA(lpVersionInformation)
If (lpVersionInformation.dwPlatformId = Platform_Windows_32) Then
OperatingSystem = System_Windows_32
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion = 0) Then
OperatingSystem = System_Windows_95
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion = 10) Then
OperatingSystem = System_Windows_98
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_95_98_ME) And (lpVersionInformation.dwMinorVersion = 90) Then
OperatingSystem = System_Windows_ME
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion < 5) Then
OperatingSystem = System_Windows_NT
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion = 5) And (lpVersionInformation.dwMinorVersion = 0) Then
OperatingSystem = System_Windows_2K
ElseIf (lpVersionInformation.dwPlatformId = Platform_Windows_NT_2K_XP) And (lpVersionInformation.dwMajorVersion = 5) And (lpVersionInformation.dwMinorVersion = 1) Then
OperatingSystem = System_Windows_XP
End If
End Function

شفیعی
چهارشنبه 06 خرداد 1383, 04:47 صبح
سلام
دوست عزیز خیلی ممنون
فقط وقتی برنامه را اجرا می کنم روی خط زیر ایراد می گیرد


Case 2: lbl_operatingsystem.Caption = "Windows 98"
RUN-TIME ERROR '424'
OBJECT REQUIRED

بابک زواری
پنج شنبه 07 خرداد 1383, 16:21 عصر
عزیز جان همانطور که در ابتدای برنامه نوشته شده شما احتیاج به این
لیبل دارید ( اسمش رو هم همین بذار )

شفیعی
جمعه 08 خرداد 1383, 16:30 عصر
سلام
خیلی ممنون