Announcement

Collapse
No announcement yet.

Can someone test this program in Windows 11?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
    Anne Wilson
    Member

  • Anne Wilson
    replied
    Thanks so much , Dario

    Leave a comment:

  • Dario Croci
    Member

  • Dario Croci
    replied
    Yes, it's correct.
    In Windows 11 Home 21H2 Build 22000.318, using source #1 the answer is "You are using Windows 10".
    Changing the WinVer function as #4, the answer is "You are using Windows 11".

    Leave a comment:

  • Anne Wilson
    Member

  • Anne Wilson
    replied
    Thanks guys
    Perhaps
    Code:
    FUNCTION WinVer() AS SINGLE
     LOCAL OsInfoEx AS OSVERSIONINFOEXW
     LOCAL dwVer AS SINGLE
     ' Win 2000 --> 5.0, XP --> 5.1, Win 2003 --> 5.2,
     ' Vista --> 6.0 Seven --> 6.1,
     ' Eight.Zero --> 6.2, Eight.One --> 6.3, and Ten --> 10.0.
    
     'Get Windows version, Windows 8 & 10 included, unicode only available
     RtlGetVersion(OsInfoEx)
     dwVer = OsInfoEx.dwMajorVersion + OsInfoEx.dwMinorVersion / _
          IIF(OsInfoEx.dwMinorVersion > 9, 100, 10)
      IF dwVer = 10 THEN
         IF OsInfoEx.dwBuildNUmber >= 22000  THEN
             dwVer = 11
         END IF
      END IF
      FUNCTION = dwVer
    END FUNCTION

    Leave a comment:

  • Stuart McLachlan
    Member

  • Stuart McLachlan
    replied
    From what I've read, WIndows 11 is still dwMajorVersion = 10, dwMinorVersion = 0
    But dwBuildNUmber is >= 22000

    So a minot tweak to the function should differentiate the two, but it would currently return Ver 10 for Ver 11.

    Leave a comment:

  • Frank Rogers
    Member

  • Frank Rogers
    replied
    I don't have 11 but looking at MSDN it doesn't list Windows 11 in the remarks section.

    Leave a comment:

  • Anne Wilson
    Member

  • Anne Wilson
    started a topic Can someone test this program in Windows 11?

    Can someone test this program in Windows 11?

    The following program was written by Pierre to get the version of Windows OS
    It was tested for versions Windows 2000 through to Windows 10 and it works perfectly.

    I don't have a Windows 11 OS yet to test this program, therefore will someone with a
    Windows 11 OS please test this program out and revert back to us on this forum?

    Code:
    ' Detect OS version.bas
    ' https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/758292-how-to-detect-windows-versions?p=758294#post758294
    ' By Pierre
    
    'Can detect Window version from 2000 to Ten
    #DIM ALL
    #INCLUDE "Win32Api.inc"
    
    #IF %PB_REVISION < &H1000
    TYPE OSVERSIONINFOEXW
      dwOSVersionInfoSize
      dwMajorVersion      AS DWORD
      dwMinorVersion      AS DWORD
      dwBuildNumber       AS DWORD
      dwPlatformId        AS DWORD
      szCSDVersion        AS STRING * 128 * 2  'Maintenance string for PSS usage (WSTRINGZ)
      wServicePackMajor   AS WORD
      wServicePackMinor   AS WORD
      wSuiteMask          AS WORD
      wProductType        AS BYTE
      wReserved           AS BYTE
    END TYPE
    #ENDIF
    
    DECLARE FUNCTION RtlGetVersion LIB "NtDll.dll" ALIAS "RtlGetVersion" _
    (OsVerInfoEx AS OSVERSIONINFOEXW)  AS LONG 'Unicode function, returns %STATUS_SUCCESS (0) on success.
    
    
    '==============================
    FUNCTION WinVer() AS SINGLE
     LOCAL OsInfoEx AS OSVERSIONINFOEXW
     '2000 5.0, XP 5.1, 2003 5.2, Vista 6.0 Seven 6.1, Eight.Zero 6.2, Eight.One 6.3, and Ten 10.0.
    
     RtlGetVersion(OsInfoEx) 'Get Windows version, Windows 8 & 10 included, unicode only available
     FUNCTION = OsInfoEx.dwMajorVersion + OsInfoEx.dwMinorVersion / IIF(OsInfoEx.dwMinorVersion > 9, 100, 10)
    
    END FUNCTION
    
    
    
    '==========================
    FUNCTION PBMAIN() AS LONG
    
     MSGBOX "You are using Windows version " + STR$(WinVer()), , "Win Version"
    
    END FUNCTION
Working...
X