Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help to distinguish between Win98 & Win98SE 2

Status
Not open for further replies.

Unscruffed

Programmer
Apr 2, 2002
102
AU
I'm making a custom CD with some progs that work with Windows 98 Second Edition, but not Windows 98. The main menu of the CD enables or disables items according to the OS on which it is running. I've got a module (see link below) that determines which OS is running. I can't however, find any information on how to distinguish between Win98 and Win98SE.

Any help appreciated.

This is the module I am currently using:
Cheers,
Scruff.
PS: Feel free to check out babieswithrabies.com while you're there. :)

Be good. If you can't, don't get caught!
 
You can do it with an API call or using the SysInfo control. Here's an example of both, and I've included a table with the identifying characteristics (where I know them):
[tt]
Option Explicit

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (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 ' Maintenance string for PSS usage
End Type

Private Const VER_PLATFORM_WIN32s = 0 ' Win32s on Windows 3.1
Private Const VER_PLATFORM_WIN32_WINDOWS = 1 ' Windows 95, Windows 98, or Windows Me
Private Const VER_PLATFORM_WIN32_NT = 2 ' Windows NT, Windows 2000, Windows XP, or Windows Server 2003 family.

' Major Minor
' OS Platform Version Version Build
' Windows 95 1 4 0
' Windows 98 1 4 10 1998
' Windows 98SE 1 4 10 2222
' Windows Me 1 4 90 3000
' NT 3.51 2 3 51
' NT 2 4 0 1381
' 2000 2 5 0
' XP 2 5 1 2600
' Server 2003 2 5 2




Private Sub Command1_Click()
Dim OSInfo As OSVERSIONINFO
OSInfo.dwOSVersionInfoSize = Len(OSInfo)


' SysInfo version
If SysInfo1.OSPlatform = VER_PLATFORM_WIN32_WINDOWS Then ' OK, could be W98SE
If CInt(SysInfo1.OSVersion) = 4 Then ' OK, it is W98
If SysInfo1.OSBuild = 2222 Then
' Yep, we've found W98SE!
End If
End If
End If

'API Version
GetVersionEx OSInfo
If OSInfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then ' OK, could be W98SE
If OSInfo.dwMajorVersion = 4 Then
If (OSInfo.dwBuildNumber And &HFFFF) = 2222 Then ' Build number is in loword for w9x family
' Yep, we've found W98SE!
End If
End If
End If
End Sub
 
Lazy hazt days of summer and it is early Sunday morning (at least near here).

The first routine doesn't have the strutctre (type) for SysInfo1, so fails with an error.

The second (appears) to need the const and / or mask to be different, as the actual value returned on my (Win 98 SE) system is actually 67766446. Doiung the bitwise "and" of all 1's obviously doesn't modify it, so while it doesn't fail, it doesn't properly identify the O.S. as Win 98 SE.





MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
1. I think that that's because it uses the SysInfo control; you need to put an instance of that on your form to be able to use it.

2. dwBuildNumber is a long integer (4 bytes). The mask is a two byte mask so, if there's bits set in the HIWORD portion of the dwBuildNumber , they WILL be reset to 0. What MIGHT be possible (didn't try, but COULD be) is that VB sees the mask as a "-1" (0xFFFFFFFF) instead of 65535 (0x0000FFFF), since it's not specified as a long integer. Maybe &HFFFF& WILL reset the bits in the HIWORD portion.

Greetings,
Rick
 
Sysinfo is a control, as mentioned in the post; you don't need structure for it, just to drop an instance onto you're form.

I was being too quick with the bitmasking in the API version and missed an important symbol off. The following line:
[tt]
If (OSInfo.dwBuildNumber And &HFFFF) = 2222 Then
[/tt]
should read:
[tt]
If (OSInfo.dwBuildNumber And &HFFFF&) = 2222 Then
 

I think Strongm hit the nail on the head with the build numbers. "Windows 98 Second Edition" is build 2222, thus any build below that should be Windows 98. Since I have got Win98SE (build 2222), common sense should have given me the answer. :)

Strongm: I haven't found the info in your table anywhere. Thanks for posting it here because I'm sure that it will help everyone. (BTW, my Win2K (professional) is build 2195. I wonder is it different between Server & Pro. Hmmm)

For all who read this thread, take paticular note of the build numbers in the table above.

Strongm: You get a star for that one mate. Cheers.

This thread should be considered closed.
Thanks everyone for your help. It is very much appreciated.
Scruff.

Be good. If you can't, don't get caught!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top