Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to determine which operating system

Posted on 1998-12-03
2
Medium Priority
?
353 Views
Last Modified: 2012-06-21
I need to determine which operating system my application is running on. It is a 16bit app so could run on Windows 3.1, 3.11, 95, 98 or NT.
0
Comment
Question by:johnnymccarthy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1448018
Here is under 32 bits.

' #VBIDEUtils#************************************************************
' * Programmer Name  : Waty Thierry
' * Web Site         : www.geocities.com/ResearchTriangle/6311/
' * E-Mail           : waty.thierry@usa.net
' * Date             : 7/10/98
' * Time             : 14:39
' * Module Name      : System_Information_Module
' * Module Filename  :
' **********************************************************************
' * Comments         : Get some system information
' *
' *
' **********************************************************************

Option Explicit

' *** System Parameters Information Constants, Types and Declares
Public Const SPI_GETBEEP = 1
Public Const SPI_GETANIMATION = 72
Public Const SPI_GETBORDER = 5
Public Const SPI_GETDEFAULTINPUTLANG = 89
Public Const SPI_GETFONTSMOOTHING = 74
Public Const SPI_GETGRIDGRANULARITY = 18
Public Const SPI_GETICONTITLEWRAP = 25
Public Const SPI_GETKEYBOARDDELAY = 22
Public Const SPI_GETKEYBOARDSPEED = 10
Public Const SPI_GETKEYBOARDPREF = 68
Public Const SPI_GETMENUDROPALIGNMENT = 27
Public Const SPI_GETMOUSETRAILS = 94
Public Const SPI_GETSCREENREADER = 70
Public Const SPI_GETSCREENSAVEACTIVE = 16
Public Const SPI_GETSCREENSAVETIMEOUT = 14
Public Const SPI_GETSHOWSOUNDS = 56
Public Const SPI_GETWINDOWSEXTENSION = 92
Public Const SPI_GETWORKAREA = 48

Type ANIMATIONINFO
   cbSize As Long
   iMinAnimate As Long
End Type

Type RECT
   Left   As Long
   Top    As Long
   Right  As Long
   Bottom As Long
End Type

Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long

' *** Operating System Constants, Types and Declares
Public Const VER_PLATFORM_WIN32s = 0
Public Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Const VER_PLATFORM_WIN32_NT = 2

Type OSVERSIONINFO
   dwOSVersionInfoSize As Long
   dwMajorVersion      As Long
   dwMinorVersion      As Long
   dwBuildNumber       As Long
   dwPlatformId        As Long
   szCSDVersion        As String * 128
End Type

Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

Private Sub GetSystemInformation()
   ' #VBIDEUtils#************************************************************
   ' * Programmer Name  : Waty Thierry
   ' * Web Site         : www.geocities.com/ResearchTriangle/6311/
   ' * E-Mail           : waty.thierry@usa.net
   ' * Date             : 7/10/98
   ' * Time             : 14:40
   ' * Module Name      : System_Information_Module
   ' * Module Filename  :
   ' * Procedure Name   : GetSystemInformation
   ' * Parameters       :
   ' **********************************************************************
   ' * Comments         : Get some system information
   ' *
   ' *
   ' **********************************************************************

   Dim OSInfo     As OSVERSIONINFO
   
   Dim sWindows   As String
   
   ' *** Operating System Information
   On Error Resume Next
   OSInfo.dwOSVersionInfoSize = Len(OSInfo)
   Call GetVersionEx(OSInfo)
   With OSInfo
      ' *** .dwMajorVersion
      ' *** .dwMinorVersion
      ' *** .dwPlatformId
      ' *** Trim$(.szCSDVersion)
      ' *** .dwBuildNumber
   End With

   Select Case OSInfo.dwPlatformId
      Case VER_PLATFORM_WIN32_NT
         sWindows = "NT"
      Case VER_PLATFORM_WIN32_WINDOWS
         sWindows = "Windows"
      Case VER_PLATFORM_WIN32s
         sWindows = "Windows 3.1"
   End Select
   
   ' *** System Parameters Information
   Dim iValue   As Integer
   Dim lValue   As Long
   Dim bBool    As Boolean
   Dim tRect    As RECT
   Dim tAnimate As ANIMATIONINFO
   
   ' *** Indicate whether the warning Beeper is on.
   Call SystemParametersInfo(SPI_GETBEEP, vbNull, bBool, 0)
   
   ' *** Get the border multiplier factor that determines the
   ' *** width of a windows sizing border.
   Call SystemParametersInfo(SPI_GETBORDER, vbNull, iValue, 0)
   
   ' *** Determine whether the font smoothing feature is enabled.
   ' *** This feature uses font anti-aliasing to make font curves
   ' *** appear smoother by painting pixels at different gray levels.
   Call SystemParametersInfo(SPI_GETFONTSMOOTHING, vbNull, bBool, 0)
   
   ' *** Get the current granularity value of the desktop sizing grid.
   Call SystemParametersInfo(SPI_GETGRIDGRANULARITY, vbNull, iValue, 0)
   
   ' *** Determine whether icon-title wrapping is enabled.
   Call SystemParametersInfo(SPI_GETICONTITLEWRAP, vbNull, bBool, 0)
   
   ' *** Determine whether pop-up menus are left-aligned or
   ' *** right-aligned, relative to the corresponding menu-bar item.
   Call SystemParametersInfo(SPI_GETMENUDROPALIGNMENT, vbNull, bBool, 0)
   If bBool Then
      ' *** "Left"
   Else
      ' *** "Right"
   End If
   
   ' *** Determine whether screen saving is enabled.
   Call SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, vbNull, bBool, 0)
   
   ' *** Retrieve the screen saver time-out value, in seconds.
   Call SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, vbNull, iValue, 0)
   
   ' *** Determine if the Show Sounds accessibility flag is on or
   ' *** off. If it is on, the user requires an application to present
   ' *** information visually in situations where it would otherwise
   ' *** present the information only in audible form.
   Call SystemParametersInfo(SPI_GETSHOWSOUNDS, vbNull, bBool, 0)
   
   ' *** See if animation effects are enabled.
   tAnimate.cbSize = Len(tAnimate)
   Call SystemParametersInfo(SPI_GETANIMATION, vbNull, tAnimate, 0)
   ' *** (tAnimate.iMinAnimate > 0)
   
   ' *** Retrieve the keyboard repeat-delay setting.
   Call SystemParametersInfo(SPI_GETKEYBOARDDELAY, vbNull, iValue, 0)
   
   ' *** Retrieve the keyboard repeat-speed setting.
   Call SystemParametersInfo(SPI_GETKEYBOARDSPEED, vbNull, lValue, 0)
   
   ' *** Get the keyboard layout handle for the system default input language.
   Call SystemParametersInfo(SPI_GETDEFAULTINPUTLANG, vbNull, lValue, 0)
   
   ' *** Determine if the user relies on the keyboard instead of the mouse,
   ' *** and wants applications to display keyboard interfaces that would
   ' *** otherwise be hidden.
   Call SystemParametersInfo(SPI_GETKEYBOARDPREF, vbNull, bBool, 0)
   
   ' *** Retrieve the screen's working area size (i.e. the portion of
   ' *** the screen not obscured by the taskbar or other appbars).
   Call SystemParametersInfo(SPI_GETWORKAREA, vbNull, tRect, 0)
   
   ' *** WINDOWS 9x ONLY.
   If sWindows = "Windows" Then
     
      ' *** Indicate if the Mouse Trails feature is enabled. This feature
      ' *** improves the visibility of mouse cursor movements by briefly
      ' *** showing a trail of cursors and quickly erasing them.
      Call SystemParametersInfo(SPI_GETMOUSETRAILS, vbNull, iValue, 0)
      ' *** (iValue > 1)
     
      ' *** Determine of a screen reviewer utility is running. A screen
      ' *** reviewer utility directs textual information to an output device,
      ' *** such as a speech synthesizer or Braille display. When this flag
      ' *** is set, an application should provide textual information in
      ' *** situations where it would otherwise present the information
      ' *** graphically.
      Call SystemParametersInfo(SPI_GETSCREENREADER, vbNull, bBool, 0)
     
      ' *** Indicate whether the Windows extension, Windows Plus!, is installed.
      bBool = SystemParametersInfo(SPI_GETWINDOWSEXTENSION, 1, 0, 0)
   End If
   
End Sub

0
 
LVL 12

Accepted Solution

by:
mark2150 earned 100 total points
ID: 1448019
SHELL( ENVIRON("COMSPEC") & "COMMAND.COM /C VER > C:\X", 1)
OPEN "C:\X" FOR INPUT AS #1
LINE INPUT #1 VERSIONINFO
CLOSE


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question