Help and Support
 

powered byLive Search

ACC: How to Determine Windows and MS-DOS Versions

Retired KB ArticleThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Article ID:109723
Last Review:May 6, 2003
Revision:2.0
This article was previously published under Q109723

SUMMARY

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article describes how you can use the GetVersion() Windows API function to return the version numbers of Microsoft Windows and MS-DOS running on the computer.

This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual in Microsoft Access version 1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access Basic" in version 2.0.

Back to the top

MORE INFORMATION

The following example demonstrates how to use the GetVersion() Windows API function in the KERNEL.EXE dynamic link library (DLL) included with Windows:

NOTE: In the following sample code, an underscore (_) is used as a line- continuation character. Remove the underscore when re-creating this code in Access Basic.
   '====================================
   ' Global Declarations
   '====================================
   Option Explicit

   Declare Function GetVersion Lib "Kernel" () As Long

   Function SysVersions ()
      Dim ver As Long, WinVer As Long, DosVer As Long
      Dim WindowsVersion As String, DosVersion As String

      ver = GetVersion()

      WinVer = ver And &HFFF&
      WindowsVersion = Format((WinVer Mod 256) + _
         ((WinVer \ 256) / 100), "Fixed")

      DosVer = ver \ &H10000
      DosVersion = Format((DosVer \ 256) + _
         ((DosVer Mod 256) / 100), "Fixed")

      MsgBox "Windows Version: " & WindowsVersion _
         & Chr(13) & "DOS Version: " & DosVersion

   End Function
				

The GetVersion() function returns a value that is a DWORD (double word), which translates into a long integer (32-bit value) in Access Basic. The low-order word returns the major (low byte) and minor (high byte) Windows version number, and the high-order word returns the major (high byte) and minor (low byte) MS-DOS version number.

Back to the top

REFERENCES

Microsoft Windows Software Development Kit "Programmer's Reference Volume 2: Functions," pages 469-470

Back to the top


APPLIES TO
Microsoft Access 1.0 Standard Edition
Microsoft Access 1.1 Standard Edition
Microsoft Access 2.0 Standard Edition

Back to the top

Keywords: 
kbhowto kbprogramming KB109723

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.