Is NT or Windows95/98 
Author Message
 Is NT or Windows95/98

Hello,

How can i check if a program is run on Windows NT or Windows95/98 ??

Is there a api call to check this ?

Greetings Chris



Mon, 18 Mar 2002 03:00:00 GMT  
 Is NT or Windows95/98

<How can i check if a program is run on Windows NT or Windows95/98 ??

        http://support.microsoft.com/support/kb/articles/q189/2/49.asp

--
Paul Marshall



Mon, 18 Mar 2002 03:00:00 GMT  
 Is NT or Windows95/98


Quote:
> Hello,

> How can i check if a program is run on Windows NT or Windows95/98 ??

> Is there a api call to check this ?

> Greetings Chris

Useful API's for what you want and more

Const VER_PLATFORM_WIN32_NT& = 2
Const VER_PLATFORM_WIN32_WINDOWS& = 1
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

Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As
SYSTEM_INFO)
Private Declare Function GetVersion Lib "kernel32" () As Long
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA"
(lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
lpvParam As Any, ByVal fuWinIni As Long) As Long

 Private Type SYSTEM_INFO
        dwOemID As Long
        dwPageSize As Long
        lpMinimumApplicationAddress As Long
        lpMaximumApplicationAddress As Long
        dwActiveProcessorMask As Long
        dwNumberOfProcessors As Long
        dwProcessorType As Long
        dwAllocationGranularity As Long
        wProcessorLevel As Integer
        wProcessorRevision As Integer
End Type

Private Type OSVERSIONINFO ' 148 bytes
        dwOSVersionInfoSize As Long
        dwMajorVersion As Long
        dwMinorVersion As Long
        dwBuildNumber As Long
        dwPlatformId As Long
        szCSDVersion As String * 128
End Type

'code to do what you want and more
    Dim flagnum&
    Dim dl&, s$
    Dim vernum&, verword%
    Dim mySys As SYSTEM_INFO
    Dim myVer As OSVERSIONINFO

       ' Get the windows flags and version numbers
        myVer.dwOSVersionInfoSize = 148
        dl& = GetVersionEx&(myVer)
        If myVer.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then
            s$ = "Running Windows '95 "
        ElseIf myVer.dwPlatformId = VER_PLATFORM_WIN32_NT Then
            s$ = " Windows NT "
        End If
        Label1 = s$ & myVer.dwMajorVersion & "." & myVer.dwMinorVersion & "
Build " & (myVer.dwBuildNumber And &HFFFF&)

        GetSystemInfo mySys
         Info$ = " Processor:  "
        Select Case mySys.dwProcessorType
            Case PROCESSOR_INTEL_386
                    Label2.Caption = Info$ & "Intel 386"
            Case PROCESSOR_INTEL_486
                    Label2.Caption = Info$ & "Intel 486"
            Case PROCESSOR_INTEL_PENTIUM
                    Label2.Caption = Info$ & "Intel Pentium"
            Case PROCESSOR_MIPS_R4000
                     Label2.Caption = Info$ & "RISC R4000"
            Case PROCESSOR_ALPHA_21064
                    Label2.Caption = Info$ & "Alpha 21064"
        End Select

Ron



Mon, 18 Mar 2002 03:00:00 GMT  
 Is NT or Windows95/98
Hi Chris,

DL the WindowsVersion.bas from our site (address below).
It also knows Windows 98 SE and Windows 2000.

--
Hope this helps ...

Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de
Please reply to the newsgroup :-)



Quote:
> Hello,

> How can i check if a program is run on Windows NT or Windows95/98 ??

> Is there a api call to check this ?

> Greetings Chris



Mon, 18 Mar 2002 03:00:00 GMT  
 Is NT or Windows95/98

Quote:

>Hello,

>How can i check if a program is run on Windows NT or Windows95/98 ??

>Is there a api call to check this ?

>Greetings Chris

Here's the code for a program that evaluates the data:

Option Explicit

Private Declare Function GetVersionEx Lib "Kernel32" Alias "GetVersionExA"
(lpVersionInformation As OSVERSIONINFO) As Long 'bcbc Must make public so
other routines can see...
Private Type OSVERSIONINFO 'for GetVersionEx API call 'bcbc - Must make
public so other routines can see...
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type
Private currWinVersion As Long
Private Const WIN_NONE = 0
Private Const WIN_95 = 1
Private Const WIN_98 = 2
Private Const WIN_NT = 3
Private Const WIN_2000 = 4
Dim os(4) As String

Public Sub SetWindowsVersion()
Dim myOSverInfo As OSVERSIONINFO
Dim temp As Long

  myOSverInfo.dwOSVersionInfoSize = 148   'Must set the size to 148 before
the call

  temp = GetVersionEx(myOSverInfo)

  Select Case myOSverInfo.dwMajorVersion

    Case 5
        currWinVersion = WIN_2000   'Win NT5/2000
    Case 4
        Select Case myOSverInfo.dwPlatformId
            Case 1                          'Win 9x
                Select Case myOSverInfo.dwMinorVersion
                    Case 0
                        currWinVersion = WIN_95     'Win95
                    Case 10
                        currWinVersion = WIN_98     'Win98
                    Case Else
                        currWinVersion = WIN_NONE  'Who knows?
                End Select
            Case 2
                If myOSverInfo.dwMinorVersion = 0 Then currWinVersion =
WIN_NT 'Win NT 4x
        End Select
    Case Else
        currWinVersion = WIN_NONE           'Win 3.x or NT 3.x
  End Select
  txtStatus.Text = "Major Version = " & myOSverInfo.dwMajorVersion _
    & vbCrLf & "Minor Version = " & myOSverInfo.dwMinorVersion _
    & vbCrLf & "Build Number = " & myOSverInfo.dwBuildNumber _
    & vbCrLf & "Platform ID = " & myOSverInfo.dwPlatformId _
    & vbCrLf & "Calculated OS = " & os(currWinVersion)
End Sub

Private Sub Form_Load()
  os(0) = "None"
  os(1) = "Windows 95"
  os(2) = "Windows 98"
  os(3) = "Windows NT"
  os(4) = "Windows 2000"
  SetWindowsVersion
End Sub



Mon, 18 Mar 2002 03:00:00 GMT  
 Is NT or Windows95/98
Kind of overkill from a perf standpoint, for just this one
piece of info.

Public Declare Function GetVersion Lib "kernel32" () As Long

Public Function FOnNT() As Boolean
    FOnNT = (GetVersion < 2147483648#)
End Function

This works just as well. Save the GetVersionEx call for when
you need the other info it provides....

--
MichKa

-------------------------------------
don't send questions by e-mail unless
you're paying for it. (TANSTAAFL!) :-)

random junk of dubious value and
replica error and problem fixing at:
http://www.trigeminal.com


Quote:


> >Hello,

> >How can i check if a program is run on Windows NT or
Windows95/98 ??

> >Is there a api call to check this ?

> >Greetings Chris

> Here's the code for a program that evaluates the data:

> Option Explicit

> Private Declare Function GetVersionEx Lib "Kernel32" Alias
"GetVersionExA"
> (lpVersionInformation As OSVERSIONINFO) As Long 'bcbc Must
make public so
> other routines can see...
> Private Type OSVERSIONINFO 'for GetVersionEx API call
'bcbc - Must make
> public so other routines can see...
>     dwOSVersionInfoSize As Long
>     dwMajorVersion As Long
>     dwMinorVersion As Long
>     dwBuildNumber As Long
>     dwPlatformId As Long
>     szCSDVersion As String * 128
> End Type
> Private currWinVersion As Long
> Private Const WIN_NONE = 0
> Private Const WIN_95 = 1
> Private Const WIN_98 = 2
> Private Const WIN_NT = 3
> Private Const WIN_2000 = 4
> Dim os(4) As String

> Public Sub SetWindowsVersion()
> Dim myOSverInfo As OSVERSIONINFO
> Dim temp As Long

>   myOSverInfo.dwOSVersionInfoSize = 148   'Must set the
size to 148 before
> the call

>   temp = GetVersionEx(myOSverInfo)

>   Select Case myOSverInfo.dwMajorVersion

>     Case 5
>         currWinVersion = WIN_2000   'Win NT5/2000
>     Case 4
>         Select Case myOSverInfo.dwPlatformId
>             Case 1                          'Win 9x
>                 Select Case myOSverInfo.dwMinorVersion
>                     Case 0
>                         currWinVersion = WIN_95     'Win95
>                     Case 10
>                         currWinVersion = WIN_98     'Win98
>                     Case Else
>                         currWinVersion = WIN_NONE  'Who
knows?
>                 End Select
>             Case 2
>                 If myOSverInfo.dwMinorVersion = 0 Then
currWinVersion =
> WIN_NT 'Win NT 4x
>         End Select
>     Case Else
>         currWinVersion = WIN_NONE           'Win 3.x or NT
3.x
>   End Select
>   txtStatus.Text = "Major Version = " &

myOSverInfo.dwMajorVersion _
Quote:
>     & vbCrLf & "Minor Version = " &

myOSverInfo.dwMinorVersion _
Quote:
>     & vbCrLf & "Build Number = " &

myOSverInfo.dwBuildNumber _

- Show quoted text -

Quote:
>     & vbCrLf & "Platform ID = " & myOSverInfo.dwPlatformId
_
>     & vbCrLf & "Calculated OS = " & os(currWinVersion)
> End Sub

> Private Sub Form_Load()
>   os(0) = "None"
>   os(1) = "Windows 95"
>   os(2) = "Windows 98"
>   os(3) = "Windows NT"
>   os(4) = "Windows 2000"
>   SetWindowsVersion
> End Sub



Mon, 18 Mar 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Internet API Reference for Windows95/98/NT

2. Is NT or Windows95/98

3. Is NT or Windows95/98

4. Problem: RASEO_TerminalBefore/AfterDial Windows95/98/NT

5. Where can I find API to administer NT from Windows95/98 application

6. Disable Windows95/98 Task Bar

7. How to automate Dial up connection with RAs in Windows95/98

8. MSCOMM32.OCX on Windows95/98?

9. Adding an app to the Windows95/98 tray (the icons by the clock)

10. File permission from windows95/98

11. I am looking for a complete technical reference for OUTLOOK 98

12. GetOpenFileName:Win 98 vs. NT

 

 
Powered by phpBB® Forum Software