Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #14120

Re: Access 2016 Get Windows Build

From Ron Weiner <rw@domain.com>
Newsgroups comp.databases.ms-access
Subject Re: Access 2016 Get Windows Build
Date 2020-06-19 13:29 -0400
Organization WorksRite
Message-ID <rcisli$v7f$1@dont-email.me> (permalink)
References <6r2cefpo4l8hoh66a4cjtum3pj7fvrbc2a@4ax.com> <rcakgp$61t$1@dont-email.me>

Show all headers | View raw


Ron Weiner presented the following explanation :
> Jürgen Meyer brought next idea :
>> The following shows me the build number
>>
>> Function Test()
>> strComputer = "."
>> Set objWMIService = GetObject("winmgmts:" &
>> "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>> Set colOperatingSystems = objWMIService.ExecQuery("Select * from
>> Win32_OperatingSystem")
>> For Each objOperatingSystem In colOperatingSystems
>>     Debug.Print objOperatingSystem.Caption & "  " & 
>> objOperatingSystem.Version & " " & objOperatingSystem.Build Number
>> Next
>> End Function
>>
>> It shows me: 19041
>> But the info is not complete
>> I want to get the complete build number
>> In this case:
>> 19041.329
>>
>> Any idea?
>>
>> Rgds
>> Juergen
>
> I guess you could always shell to a command prompt and run a VER command.  
> I'v not tryed thisd from Access but from the command prompt I get:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> C:\Users\rweiner>ver
>
> Microsoft Windows [Version 10.0.18362.900]
>
> C:\Users\rweiner>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> Seels to me that you could pipe the output to a text file, open the text 
> file, and parse the contents and "Bob's uour uncle".
>
> Ron W

Kinda weird replying to my own post, but today I decided ti test my 
Shell to a command prompt theory.  Here is some bare bones code that 
seems to work here in my environment.  I have all of this in a standard 
Access Code Module.

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMillseconds As Long)

Public Function WinVer() As String
' Get Windows version with the complete build number
    Dim strCurDir As String, strCmdLine As String
    Dim strVerResult As String
    Dim lngFilenum As Long

    strCurDir = CurDir() & "\"
    Call Shell("cmd /k ver > rdub.txt ", vbHide)
    Call Sleep(250)
    lngFilenum = FreeFile()
    Open strCurDir & "rdub.txt" For Input As #lngFilenum
    strVerResult = Input$(LOF(lngFilenum), lngFilenum)
    Close lngFilenum
    Kill strCurDir & "rdub.txt"
    WinVer = strVerResult
End Function

In a production app there'd have to be error checking, and I'd take a 
decidely more defensive style around the File location, but as a proof 
of concept, I have to say this is a workable method.

Rdub

-- 
This email has been checked for viruses by AVG.
https://www.avg.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Access 2016 Get Windows Build Jürgen Meyer <juergen.ul.meyer@gmx.de> - 2020-06-14 13:37 +0200
  Re: Access 2016 Get Windows Build Ulrich Möller <knobbi38@arcor.de> - 2020-06-14 21:51 +0200
    Re: Access 2016 Get Windows Build Jürgen Meyer <juergen.ul.meyer@gmx.de> - 2020-06-14 22:16 +0200
      Re: Access 2016 Get Windows Build Ulrich Möller <knobbi38@arcor.de> - 2020-06-15 21:51 +0200
  Re: Access 2016 Get Windows Build Ron Paii <ron81pai@gmail.com> - 2020-06-15 06:00 -0700
    Re: Access 2016 Get Windows Build Ulrich Möller <knobbi38@arcor.de> - 2020-06-15 21:56 +0200
      Re: Access 2016 Get Windows Build Ron Paii <ron81pai@gmail.com> - 2020-06-16 04:57 -0700
        Re: Access 2016 Get Windows Build Jürgen Meyer <juergen.ul.meyer@gmx.de> - 2020-06-17 11:39 +0200
  Re: Access 2016 Get Windows Build Ron Weiner <rw@domain.com> - 2020-06-16 10:21 -0400
    Re: Access 2016 Get Windows Build Ron Weiner <rw@domain.com> - 2020-06-19 13:29 -0400
      Re: Access 2016 Get Windows Build Ron Paii <ron81pai@gmail.com> - 2020-06-19 10:42 -0700
      Re: Access 2016 Get Windows Build Jürgen Meyer <juergen.ul.meyer@gmx.de> - 2020-06-20 16:53 +0200

csiph-web