ID Number: Q80642
1.00
WINDOWS
Summary:
From a Visual Basic program, you can determine the version of Windows
under which your program is running by calling the API GetVersion
function from the Windows "kernel" module. The GetVersion function can
help your program accommodate any known differences, if any, in the
way API calls operate between different versions of Windows (such as
differences between API parameters or return values).
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
The code example below shows how to make the GetVersion function call,
which takes no parameters. The return value is a WORD value, which
means an integer in Visual Basic. The return value specifies the
major and minor version numbers of Windows. The high order byte
specifies the minor version and the low order byte specifies the
major version number.
This information is documented in the Microsoft Windows Software
Development Kit Guide to Programming" version 3.0 manual.
Code Example
------------
1. Create a form with a text box and a command button.
2. Add the following declaration to the General Declarations section:
Declare Function GetVersion Lib "kernel" () As Integer
3. Add following code to the command button Click event:
Sub Command1_Click ()
i% = GetVersion()
' lowbyte is derived by masking off high byte
lowbyte$ = Str$(i% And &HFF)
' highbyte is derived by masking off low byte and shifting
highbyte$ = LTrim$(Str$((i% And &HFF00) / 256))
' assign windows version to text property
text1.text = lowbyte$ + "." + highbyte$
End Sub
Additional reference words: 1.00