Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
getversion (kernel32)

C# Signature:

static extern uint GetVersion();

User-Defined Types:



Retrieves the version number of the current operating system

Tips & Tricks:

Please add some!

Sample Code:

    using System;
    using System.Text;
    using System.Runtime.InteropServices;

    namespace test
        class Program
            static void Main(string[] args)
                StringBuilder str = new StringBuilder(100);
                uint dwWersion = WinAPI.GetVersion();

                if (dwWersion < 0x80000000)
                    str.Append("." + WinAPI.HiWord(dwWersion).ToString());
                Console.WriteLine("OS Version is " + str.ToString());

        static class WinAPI
            public static uint LoWord(uint dwValue)
                return dwValue & 0xFFFF;

            public static uint HiWord(uint dwValue)
                return (dwValue >> 16) & 0xFFFF;

            public static ushort LoByte(ushort wValue)
                return (ushort)(wValue & 0xFF);

            public static ushort HiByte(ushort wValue)
                return (ushort)((wValue >> 8) & 0xFF);

            public static extern uint GetVersion();

Alternative Managed API:

GetVersionEx(), Operating System Version(), VerifyVersionInfo()

<a href="">GetVersion</href>@msdn on MSDN

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version