` Printed Icetips Article

Icetips Article



Windows API: Getting Window version info
2003-03-10 -- Andy Ireland
 
Newsgroups: comp.lang.clarion


> the same with the windows- version:
> "Windows - 4:10 Build - ..."
> if you want to know the major and/or the minor version of the system you
> have to also use string slicing - there's no function to only get that
> again!

    _ZeroMemory(address(__OSVI), size(_OSVERSIONINFOEX_))
    __OSVI.dwOSVersionInfoSize = size(_OSVERSIONINFOEX_)

    fOsVersionInfoEx = _GetVersionEx(__OSVI)
    if fOsVersionInfoEx
      __OSVI.dwOSVersionInfoSize = size(_OSVERSIONINFO_)
      if ~_GetVersionEx(__OSVI)
        return.
    end

where OSVERSIONEX etc are....

__OSVI
like(_OSVERSIONINFOEX_),auto,name('_OSVI')

_TCHAR                              equate(byte)


_OSVERSIONINFO_                     group,type
dwOSVersionInfoSize                   long
dwMajorVersion                        long
dwMinorVersion                        long
dwBuildNumber                         long
dwPlatformId                          long
szCSDVersion                          _TCHAR,dim(128)
                                    end


_OSVERSIONINFOEX_                   group(_OSVERSIONINFO_),type
wServicePackMajor                     short
wServicePackMinor                     short
wSuiteMask                            short
wProductType                          byte
wReserved                             byte
                                    end

_VER_PLATFORM_WIN32s            equate(0)
_VER_PLATFORM_WIN32_WINDOWS     equate(1)
_VER_PLATFORM_WIN32_NT          equate(2)

      _GetVersionEx(*_OSVERSIONINFOEX_
VersionInfo),short,raw,pascal,name('GetVersionExA')

      _MoveMemory(long DestinationPtr,long SourcePtr,long
dwLength),bool,raw,proc,pascal,name('RtlMoveMemory')
      _FillMemory(long DestinationPtr,long dwLength, long
Value),pascal,name('RtlFillMemory')
      _ZeroMemory(long DestinationPtr,long
dwLength),raw,pascal,name('RtlZeroMemory')

You're better off learning to prototype and use API functions yourself in
many cases.

Regards

Andy



Printed November 21, 2024, 10:04 am
This article has been viewed/printed 35216 times.
Google search has resulted in 28 hits on this article since January 25, 2004.