Results 1 to 4 of 4
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Melbourne, Australia
    Thanked 0 Times in 0 Posts

    code to obtain operating system (VBA - word97)

    Hi ya

    Does anyone know or have code to determine current operating system?
    ie I need to test whether users are on Windows NT or windows 95.
    thanks in advance Diana

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Wellington, New Zealand
    Thanked 1 Time in 1 Post

    Re: code to obtain operating system (VBA - word97)

    Try System.OperatingSystem

  3. #3

    Re: code to obtain operating system (VBA - word97)

    That line will only provide "Windows" or "Windows NT." It will not provide Windows 95.

    System.Version will provide the version number, i.e., 4.10, but that is not much help either.

    You used to be able to use the API, GetWindowsVersion(). Unfortunately, since the release of Windows 95 in July 1995, Windows 95 had 17 releases, Windows 98 had eleven, and Windows ME have already had eleven builds/updates. And that's not counting Windows NT.

    Let me quote from Jim Steven, MSCE, Sr Microsoft Windows Application Developer :

    <hr>In the old days we had a simple API function called "GetWindowsVersion()" that returned major and minor versions. You'd see something like 3.11 as the result.

    We knew we were in trouble with Chicago. Win 95 released in July 1995. It has a release number like 4.0.950. Win 95a went out in Dec 1995 and used both 4.00.951 and 4.00.950a id's. In early 1996 we saw 4.00.950b and 4.00.1000 and 4.00.1111.

    The differences included things like supporting drives greater than 2 GB, memory sizes greater than 512 MB and shell changes.

    Now we must use GetVersionEx() to retrieve a data structure.

    In that structure we look at the dwPlatformId to see if it's Win32s, Win32 or Win32 NT. If it's Win32, you have permutations for Win98 or Win95 or WinME, and within these you have permutations for MS Plus! or Internet Explorer installations.

    And an item that many developers forget to check is the item called osvi.dwBuildNumber. If you don't check it, the runtime DLL's you may have compiled for may not support the specific function you are trying to use. In simpler terms, you may not have the "file open" dialog box that I wrote code to use.

    Sometimes I think pencil and paper were easier.

    Jim Steven, MCSE
    Sr Microsoft Windows Application Developer

    So, System.OperatingSystem may work in this case, but there is more going on than that function can provide.

    Oh, for those who may still create batch files, the many different versions of Windows have different quirks depending on which of the 39 versions you are actually accessing. So, you can create a batch file for one version and it will not work for another! How 'bout them apples????

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Springfield, Ohio, USA
    Thanked 2 Times in 2 Posts

    Re: code to obtain operating system (VBA - word97)

    Q189249 on How to determine which 32-bit windows version is being used.

    Hope this helps! --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts